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 1
1
{{define "dbCodeTemplateStd"}}
2
2
type DBTX interface {
3
+ BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error)
3
4
ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
4
5
PrepareContext(context.Context, string) (*sql.Stmt, error)
5
6
QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
@@ -101,5 +102,12 @@ func (q *Queries) WithTx(tx *sql.Tx) *Queries {
101
102
{{- end}}
102
103
}
103
104
}
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
+ }
104
112
{{end}}
105
113
{{end}}
You can’t perform that action at this time.
0 commit comments