1414 Service interface {
1515 Pool () * pgxpool.Pool
1616 Migrate (queries ... string ) error
17- CreateTransaction (fn func (tx pgx.Tx ) error ) error
17+ CreateTransaction (fn func (ctx context. Context , tx pgx.Tx ) error ) error
1818 CreateTransactionWithCtx (
1919 ctx context.Context ,
2020 fn func (ctx context.Context , tx pgx.Tx ) error ,
@@ -69,7 +69,7 @@ func (d *DefaultService) Migrate(queries ...string) error {
6969
7070 // Create a new transaction
7171 return d .CreateTransaction (
72- func (tx pgx.Tx ) error {
72+ func (ctx context. Context , tx pgx.Tx ) error {
7373 // Execute the migration
7474 for _ , query := range queries {
7575 if _ , err := tx .Exec (context .Background (), query ); err != nil {
@@ -82,14 +82,19 @@ func (d *DefaultService) Migrate(queries ...string) error {
8282}
8383
8484// CreateTransaction creates a transaction for the database
85- func (d * DefaultService ) CreateTransaction (fn func (tx pgx.Tx ) error ) error {
85+ func (d * DefaultService ) CreateTransaction (
86+ fn func (
87+ ctx context.Context ,
88+ tx pgx.Tx ,
89+ ) error ,
90+ ) error {
8691 return CreateTransaction (d .pool , fn )
8792}
8893
8994// CreateTransactionWithCtx creates a transaction for the database with a context
9095func (d * DefaultService ) CreateTransactionWithCtx (
9196 ctx context.Context ,
92- fn func (tx pgx.Tx ) error ,
97+ fn func (ctx context. Context , tx pgx.Tx ) error ,
9398) error {
9499 return CreateTransactionWithCtx (ctx , d .pool , fn )
95100}
0 commit comments