MCPcopy
hub / github.com/jmoiron/sqlx / NamedQueryContext

Function NamedQueryContext

named_context.go:116–122  ·  view source on GitHub ↗

NamedQueryContext binds a named query and then runs Query on the result using the provided Ext (sqlx.Tx, sqlx.Db). It works with both structs and with map[string]interface{} types.

(ctx context.Context, e ExtContext, query string, arg interface{})

Source from the content-addressed store, hash-verified

114// provided Ext (sqlx.Tx, sqlx.Db). It works with both structs and with
115// map[string]interface{} types.
116func NamedQueryContext(ctx context.Context, e ExtContext, query string, arg interface{}) (*Rows, error) {
117 q, args, err := bindNamedMapper(BindType(e.DriverName()), query, arg, mapperFor(e))
118 if err != nil {
119 return nil, err
120 }
121 return e.QueryxContext(ctx, q, args...)
122}
123
124// NamedExecContext uses BindStruct to get a query executable by the driver and
125// then runs Exec on the result. Returns an error from the binding

Callers 1

NamedQueryContextMethod · 0.85

Calls 5

bindNamedMapperFunction · 0.85
BindTypeFunction · 0.85
mapperForFunction · 0.85
DriverNameMethod · 0.65
QueryxContextMethod · 0.65

Tested by

no test coverage detected