Source File
squirrel_ctx.go
Belonging Package
github.com/Masterminds/squirrel
package squirrel
import (
)
var NoContextSupport = errors.New("DB does not support Context")
type QueryRowerContext interface {
QueryRowContext(ctx context.Context, query string, args ...interface{}) RowScanner
}
type RunnerContext interface {
Runner
QueryerContext
QueryRowerContext
ExecerContext
}
func ( StdSqlCtx) RunnerContext {
return &stdsqlCtxRunner{}
}
type StdSqlCtx interface {
StdSql
QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
QueryRowContext(context.Context, string, ...interface{}) *sql.Row
ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
}
type stdsqlCtxRunner struct {
StdSqlCtx
}
func ( *stdsqlCtxRunner) ( string, ...interface{}) RowScanner {
return .StdSqlCtx.QueryRow(, ...)
}
func ( *stdsqlCtxRunner) ( context.Context, string, ...interface{}) RowScanner {
return .StdSqlCtx.QueryRowContext(, , ...)
}
func ( context.Context, ExecerContext, Sqlizer) ( sql.Result, error) {
, , := .ToSql()
if != nil {
return
}
return .ExecContext(, , ...)
}
func ( context.Context, QueryerContext, Sqlizer) ( *sql.Rows, error) {
, , := .ToSql()
if != nil {
return
}
return .QueryContext(, , ...)
}
func ( context.Context, QueryRowerContext, Sqlizer) RowScanner {
, , := .ToSql()
return &Row{RowScanner: .QueryRowContext(, , ...), err: }
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |