Query acquires a connection and executes a query that returns [pgx.Rows]. Arguments should be referenced positionally from the SQL string as $1, $2, etc. See [pgx.Rows] documentation to close the returned [pgx.Rows] and return the acquired connection to the [Pool]. If there is an error, the returne
(ctx context.Context, sql string, args ...any)
| 745 | // [pgx.QueryResultFormatsByOID] may be used as the first args to control exactly how the query is executed. This is rarely |
| 746 | // needed. See the documentation for those types for details. |
| 747 | func (p *Pool) Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error) { |
| 748 | c, err := p.Acquire(ctx) |
| 749 | if err != nil { |
| 750 | return errRows{err: err}, err |
| 751 | } |
| 752 | |
| 753 | rows, err := c.Query(ctx, sql, args...) |
| 754 | if err != nil { |
| 755 | c.Release() |
| 756 | return errRows{err: err}, err |
| 757 | } |
| 758 | |
| 759 | return c.getPoolRows(rows), nil |
| 760 | } |
| 761 | |
| 762 | // QueryRow acquires a connection and executes a query that is expected |
| 763 | // to return at most one row ([pgx.Row]). Errors are deferred until [pgx.Row]'s |
nothing calls this directly
no test coverage detected