Skip to content

Commit

Permalink
Merge pull request #329 from c4milo/master
Browse files Browse the repository at this point in the history
Add missing context enabled functions
  • Loading branch information
jmoiron committed Feb 28, 2018
2 parents 7cbed6a + 9afb36a commit cf35089
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions sqlx_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,19 @@ func (tx *Tx) NamedStmtContext(ctx context.Context, stmt *NamedStmt) *NamedStmt
}
}

// PreparexContext returns an sqlx.Stmt instead of a sql.Stmt.
//
// The provided context is used for the preparation of the statement, not for
// the execution of the statement.
func (tx *Tx) PreparexContext(ctx context.Context, query string) (*Stmt, error) {
return PreparexContext(ctx, tx, query)
}

// PrepareNamedContext returns an sqlx.NamedStmt
func (tx *Tx) PrepareNamedContext(ctx context.Context, query string) (*NamedStmt, error) {
return prepareNamedContext(ctx, tx, query)
}

// MustExecContext runs MustExecContext within a transaction.
// Any placeholder parameters are replaced with supplied args.
func (tx *Tx) MustExecContext(ctx context.Context, query string, args ...interface{}) sql.Result {
Expand Down

0 comments on commit cf35089

Please sign in to comment.