refactor(backend/db): remove ctx argument from transaction wrapper
This commit is contained in:
parent
5ac528be05
commit
59eacd6bc5
@ -30,13 +30,14 @@ func InitDB(connString string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func transaction(ctx context.Context, handler func(pgx.Tx) (statusCode int, err error)) (statusCode int, err error) {
|
||||
func transaction(handler func(context.Context, pgx.Tx) (statusCode int, err error)) (statusCode int, err error) {
|
||||
ctx := context.Background()
|
||||
tx, err := connPool.Begin(ctx)
|
||||
if err != nil {
|
||||
statusCode = http.StatusInternalServerError
|
||||
return
|
||||
}
|
||||
statusCode, err = handler(tx)
|
||||
statusCode, err = handler(ctx, tx)
|
||||
if err != nil {
|
||||
tx.Rollback(ctx)
|
||||
return
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user