File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
internal/codegen/golang/templates/stdlib Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 11{{define " dbCodeTemplateStd" }}
22type DBTX interface {
3+ BeginTx(ctx context.Context , opts driver.TxOptions ) (driver.Tx , error)
34 ExecContext(context.Context , string, ...interface {}) (sql.Result , error)
45 PrepareContext(context.Context , string) (*sql.Stmt , error)
56 QueryContext(context.Context , string, ...interface {}) (*sql.Rows , error)
@@ -101,5 +102,12 @@ func (q *Queries) WithTx(tx *sql.Tx) *Queries {
101102 {{- end }}
102103 }
103104}
105+ func (q *Queries) BeginTx(ctx context.Context , opts driver.TxOptions ) (*Queries, error) {
106+ tx, err := q.db.BeginTx (ctx, opts)
107+ if (err != nil {
108+ return nil , err
109+ }
110+ return q.WithTx (tx), nil
111+ }
104112{{end }}
105113{{end }}
You can’t perform that action at this time.
0 commit comments