Skip to content

Commit cf35089

Browse files
authored
Merge pull request jmoiron#329 from c4milo/master
Add missing context enabled functions
2 parents 7cbed6a + 9afb36a commit cf35089

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

sqlx_context.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,19 @@ func (tx *Tx) NamedStmtContext(ctx context.Context, stmt *NamedStmt) *NamedStmt
237237
}
238238
}
239239

240+
// PreparexContext returns an sqlx.Stmt instead of a sql.Stmt.
241+
//
242+
// The provided context is used for the preparation of the statement, not for
243+
// the execution of the statement.
244+
func (tx *Tx) PreparexContext(ctx context.Context, query string) (*Stmt, error) {
245+
return PreparexContext(ctx, tx, query)
246+
}
247+
248+
// PrepareNamedContext returns an sqlx.NamedStmt
249+
func (tx *Tx) PrepareNamedContext(ctx context.Context, query string) (*NamedStmt, error) {
250+
return prepareNamedContext(ctx, tx, query)
251+
}
252+
240253
// MustExecContext runs MustExecContext within a transaction.
241254
// Any placeholder parameters are replaced with supplied args.
242255
func (tx *Tx) MustExecContext(ctx context.Context, query string, args ...interface{}) sql.Result {

0 commit comments

Comments
 (0)