Documentation ¶
Index ¶
- func NotFound(err error) bool
- type API
- func (api *API) Exec(ctx context.Context, db Querier, query string, args ...interface{}) (pgconn.CommandTag, error)
- func (api *API) ExecNamed(ctx context.Context, db Querier, query string, arg interface{}) (pgconn.CommandTag, error)
- func (api *API) Get(ctx context.Context, db Querier, dst interface{}, query string, ...) error
- func (api *API) GetNamed(ctx context.Context, db Querier, dst interface{}, query string, ...) error
- func (api *API) PrepareNamed(query string, assertableStruct ...interface{}) (*PreparedQuery, error)
- func (api *API) Query(ctx context.Context, db Querier, query string, args ...interface{}) (pgx.Rows, error)
- func (api *API) QueryNamed(ctx context.Context, db Querier, query string, arg interface{}) (pgx.Rows, error)
- func (api *API) ScanAll(dst interface{}, rows pgx.Rows) error
- func (api *API) ScanOne(dst interface{}, rows pgx.Rows) error
- func (api *API) ScanRow(dst interface{}, rows pgx.Rows) error
- func (api *API) Select(ctx context.Context, db Querier, dst interface{}, query string, ...) error
- func (api *API) SelectNamed(ctx context.Context, db Querier, dst interface{}, query string, ...) error
- type PreparedQuery
- func (pq *PreparedQuery) ExecNamed(ctx context.Context, db Querier, arg interface{}) (pgconn.CommandTag, error)
- func (pq *PreparedQuery) GetNamed(ctx context.Context, db Querier, dst interface{}, arg interface{}) error
- func (pq *PreparedQuery) QueryNamed(ctx context.Context, db Querier, arg interface{}) (pgx.Rows, error)
- func (pq *PreparedQuery) SelectNamed(ctx context.Context, db Querier, dst interface{}, arg interface{}) error
- type Querier
- type RowsAdapter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func (*API) Exec ¶
func (api *API) Exec(ctx context.Context, db Querier, query string, args ...interface{}) (pgconn.CommandTag, error)
Exec is a high-level function that sends an executable action to the database
func (*API) ExecNamed ¶
func (api *API) ExecNamed(ctx context.Context, db Querier, query string, arg interface{}) (pgconn.CommandTag, error)
ExecNamed is a high-level function that sends an executable action to the database with named parameters
func (*API) Get ¶
func (api *API) Get(ctx context.Context, db Querier, dst interface{}, query string, args ...interface{}) error
Get is a high-level function that queries rows from Querier and calls the ScanOne function. See ScanOne for details.
func (*API) GetNamed ¶
func (api *API) GetNamed(ctx context.Context, db Querier, dst interface{}, query string, arg interface{}) error
GetNamed is a high-level function that queries rows from Querier and calls the ScanOne function. See ScanOne for details.
func (*API) PrepareNamed ¶
func (api *API) PrepareNamed(query string, assertableStruct ...interface{}) (*PreparedQuery, error)
func (*API) Query ¶
func (api *API) Query(ctx context.Context, db Querier, query string, args ...interface{}) (pgx.Rows, error)
Query is a wrapper around pgx's own query method
func (*API) QueryNamed ¶
func (api *API) QueryNamed(ctx context.Context, db Querier, query string, arg interface{}) (pgx.Rows, error)
QueryNamed is a high-level function that is used to retrieve pgx.Rows from the database with named parameters
func (*API) ScanAll ¶
ScanAll is a wrapper around the dbscan.ScanAll function. See dbscan.ScanAll for details.
func (*API) ScanOne ¶
ScanOne is a wrapper around the dbscan.ScanOne function. See dbscan.ScanOne for details. If no rows are found it returns a pgx.ErrNoRows error.
func (*API) ScanRow ¶
ScanRow is a wrapper around the dbscan.ScanRow function. See dbscan.ScanRow for details.
type PreparedQuery ¶
type PreparedQuery struct {
// contains filtered or unexported fields
}
func (*PreparedQuery) ExecNamed ¶
func (pq *PreparedQuery) ExecNamed(ctx context.Context, db Querier, arg interface{}) (pgconn.CommandTag, error)
ExecNamed is a high-level function that sends an executable action to the database with named parameters
func (*PreparedQuery) GetNamed ¶
func (pq *PreparedQuery) GetNamed(ctx context.Context, db Querier, dst interface{}, arg interface{}) error
GetNamed is a high-level function that queries rows from Querier and calls the ScanOne function. See ScanOne for details.
func (*PreparedQuery) QueryNamed ¶
func (pq *PreparedQuery) QueryNamed(ctx context.Context, db Querier, arg interface{}) (pgx.Rows, error)
QueryNamed is a high-level function that is used to retrieve *sql.Rows from the database with named parameters
func (*PreparedQuery) SelectNamed ¶
func (pq *PreparedQuery) SelectNamed(ctx context.Context, db Querier, dst interface{}, arg interface{}) error
SelectNamed is a high-level function that queries rows from Querier and calls the ScanAll function. See ScanAll for details.
type Querier ¶
type Querier interface { Query(ctx context.Context, query string, args ...interface{}) (pgx.Rows, error) Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error) }
Querier is something that pgxscan can query and get the pgx.Rows from. For example, it can be: *pgxpool.Pool, *pgx.Conn or pgx.Tx.
type RowsAdapter ¶
type RowsAdapter struct {
pgx.Rows
}
RowsAdapter makes pgx.Rows compliant with the dbscan.Rows interface. See dbscan.Rows for details.
func NewRowsAdapter ¶
func NewRowsAdapter(rows pgx.Rows) *RowsAdapter
NewRowsAdapter returns a new RowsAdapter instance.
func (RowsAdapter) Close ¶
func (ra RowsAdapter) Close() error
Close implements the dbscan.Rows.Close method.
func (RowsAdapter) Columns ¶
func (ra RowsAdapter) Columns() ([]string, error)
Columns implements the dbscan.Rows.Columns method.