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{})
| 114 | // provided Ext (sqlx.Tx, sqlx.Db). It works with both structs and with |
| 115 | // map[string]interface{} types. |
| 116 | func 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 |
no test coverage detected