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

Function SelectContext

sqlx_context.go:55–63  ·  sqlx_context.go::SelectContext

SelectContext executes a query using the provided Queryer, and StructScans each row into dest, which must be a slice. If the slice elements are scannable, then the result set must have only one column. Otherwise, StructScan is used. The *sql.Rows are closed automatically. Any placeholder parameter

(ctx context.Context, q QueryerContext, dest interface{}, query string, args ...interface{})

Source from the content-addressed store, hash-verified

53// StructScan is used. The *sql.Rows are closed automatically.
54// Any placeholder parameters are replaced with supplied args.
55func SelectContext(ctx context.Context, q QueryerContext, dest interface{}, query string, args ...interface{}) error {
56 rows, err := q.QueryxContext(ctx, query, args...)
57 if err != nil {
58 return err
59 }
60 // if something happens here, we want to make sure the rows are Closed
61 defer rows.Close()
62 return scanAll(rows, dest, false)
63}
64
65// PreparexContext prepares a statement.
66//

Callers 4

SelectContextMethod · 0.85
SelectContextMethod · 0.85
SelectContextMethod · 0.85
SelectContextMethod · 0.85

Calls 3

scanAllFunction · 0.85
QueryxContextMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected