-
Notifications
You must be signed in to change notification settings - Fork 0
Database and Secret service Implementation #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Signed-off-by: karma <captainav0608@gmail.com>
Signed-off-by: karma <captainav0608@gmail.com>
Signed-off-by: karma <captainav0608@gmail.com>
Signed-off-by: karma <captainav0608@gmail.com>
Signed-off-by: karma <captainav0608@gmail.com>
Signed-off-by: karma <captainav0608@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Combine Create, Update, Upsert
| SecretColUpdatedAt = "updated_at" | ||
| ) | ||
|
|
||
| type Secret struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at gorm implementations on how validation strings work.
|
|
||
| // NOTE : the values of constants must be consistent to the "column" in gorm tags. | ||
| const ( | ||
| // table name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as secret.go
| WebhookColUpdatedAt = "updated_at" | ||
| ) | ||
|
|
||
| type Webhook struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as secret.go
| } | ||
|
|
||
| func (s *secretStore) Create(ctx context.Context, secrets []models.Secret) error { | ||
| if ctx.Err() != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should/Can we use ctx.Done channel here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using the channel would result in writing a dedicated select block in each of the function, where the default case would be the execution part. also in the error we will have to pass ctx.Err anyways.
checking ctx.Err() directly is comparitively straighforward and readable.
|
|
||
| db-run: | ||
| @echo "Starting database container '$(DB_CONTAINER_NAME)' on port $(DB_PORT)..." | ||
| docker run --name $(DB_CONTAINER_NAME) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make a bind mount for the db data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add --rm
makefile
Outdated
| @@ -0,0 +1,26 @@ | |||
| DB_CONTAINER_NAME=shogun_db | |||
| DB_PORT=5434 | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use default postgres port for now
Signed-off-by: karma <captainav0608@gmail.com>
resolves #3 and #4