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{})
| 53 | // StructScan is used. The *sql.Rows are closed automatically. |
| 54 | // Any placeholder parameters are replaced with supplied args. |
| 55 | func 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 | // |
no test coverage detected