Documentation
¶
Index ¶
- func PrepareAllQueries(ctx context.Context, p preparer) error
- type DBQuerier
- func (q *DBQuerier) FindLtreeInput(ctx context.Context, inLtree pgtype.Text, inLtreeArray []string) (FindLtreeInputRow, error)
- func (q *DBQuerier) FindLtreeInputBatch(batch genericBatch, inLtree pgtype.Text, inLtreeArray []string)
- func (q *DBQuerier) FindLtreeInputScan(results pgx.BatchResults) (FindLtreeInputRow, error)
- func (q *DBQuerier) FindTopScienceChildren(ctx context.Context) ([]pgtype.Text, error)
- func (q *DBQuerier) FindTopScienceChildrenAgg(ctx context.Context) (pgtype.TextArray, error)
- func (q *DBQuerier) FindTopScienceChildrenAggBatch(batch genericBatch)
- func (q *DBQuerier) FindTopScienceChildrenAggScan(results pgx.BatchResults) (pgtype.TextArray, error)
- func (q *DBQuerier) FindTopScienceChildrenBatch(batch genericBatch)
- func (q *DBQuerier) FindTopScienceChildrenScan(results pgx.BatchResults) ([]pgtype.Text, error)
- func (q *DBQuerier) InsertSampleData(ctx context.Context) (pgconn.CommandTag, error)
- func (q *DBQuerier) InsertSampleDataBatch(batch genericBatch)
- func (q *DBQuerier) InsertSampleDataScan(results pgx.BatchResults) (pgconn.CommandTag, error)
- func (q *DBQuerier) WithTx(tx pgx.Tx) (*DBQuerier, error)
- type FindLtreeInputRow
- type Querier
- type QuerierConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrepareAllQueries ¶
PrepareAllQueries executes a PREPARE statement for all sqlgen generated SQL queries in querier files. Typical usage is as the AfterConnect callback for pgxpool.Config
pgx will use the prepared statement if available. Calling PrepareAllQueries is an optional optimization to avoid a network round-trip the first time pgx runs a query if pgx statement caching is enabled.
Types ¶
type DBQuerier ¶
type DBQuerier struct {
// contains filtered or unexported fields
}
func NewQuerier ¶
func NewQuerier(conn genericConn) *DBQuerier
NewQuerier creates a DBQuerier that implements Querier. conn is typically *pgx.Conn, pgx.Tx, or *pgxpool.Pool.
func NewQuerierConfig ¶
func NewQuerierConfig(conn genericConn, cfg QuerierConfig) *DBQuerier
NewQuerierConfig creates a DBQuerier that implements Querier with the given config. conn is typically *pgx.Conn, pgx.Tx, or *pgxpool.Pool.
func (*DBQuerier) FindLtreeInput ¶
func (q *DBQuerier) FindLtreeInput(ctx context.Context, inLtree pgtype.Text, inLtreeArray []string) (FindLtreeInputRow, error)
FindLtreeInput implements Querier.FindLtreeInput.
func (*DBQuerier) FindLtreeInputBatch ¶
func (q *DBQuerier) FindLtreeInputBatch(batch genericBatch, inLtree pgtype.Text, inLtreeArray []string)
FindLtreeInputBatch implements Querier.FindLtreeInputBatch.
func (*DBQuerier) FindLtreeInputScan ¶
func (q *DBQuerier) FindLtreeInputScan(results pgx.BatchResults) (FindLtreeInputRow, error)
FindLtreeInputScan implements Querier.FindLtreeInputScan.
func (*DBQuerier) FindTopScienceChildren ¶
FindTopScienceChildren implements Querier.FindTopScienceChildren.
func (*DBQuerier) FindTopScienceChildrenAgg ¶
FindTopScienceChildrenAgg implements Querier.FindTopScienceChildrenAgg.
func (*DBQuerier) FindTopScienceChildrenAggBatch ¶
func (q *DBQuerier) FindTopScienceChildrenAggBatch(batch genericBatch)
FindTopScienceChildrenAggBatch implements Querier.FindTopScienceChildrenAggBatch.
func (*DBQuerier) FindTopScienceChildrenAggScan ¶
func (q *DBQuerier) FindTopScienceChildrenAggScan(results pgx.BatchResults) (pgtype.TextArray, error)
FindTopScienceChildrenAggScan implements Querier.FindTopScienceChildrenAggScan.
func (*DBQuerier) FindTopScienceChildrenBatch ¶
func (q *DBQuerier) FindTopScienceChildrenBatch(batch genericBatch)
FindTopScienceChildrenBatch implements Querier.FindTopScienceChildrenBatch.
func (*DBQuerier) FindTopScienceChildrenScan ¶
FindTopScienceChildrenScan implements Querier.FindTopScienceChildrenScan.
func (*DBQuerier) InsertSampleData ¶
InsertSampleData implements Querier.InsertSampleData.
func (*DBQuerier) InsertSampleDataBatch ¶
func (q *DBQuerier) InsertSampleDataBatch(batch genericBatch)
InsertSampleDataBatch implements Querier.InsertSampleDataBatch.
func (*DBQuerier) InsertSampleDataScan ¶
func (q *DBQuerier) InsertSampleDataScan(results pgx.BatchResults) (pgconn.CommandTag, error)
InsertSampleDataScan implements Querier.InsertSampleDataScan.
type FindLtreeInputRow ¶
type Querier ¶
type Querier interface { FindTopScienceChildren(ctx context.Context) ([]pgtype.Text, error) // FindTopScienceChildrenBatch enqueues a FindTopScienceChildren query into batch to be executed // later by the batch. FindTopScienceChildrenBatch(batch genericBatch) // FindTopScienceChildrenScan scans the result of an executed FindTopScienceChildrenBatch query. FindTopScienceChildrenScan(results pgx.BatchResults) ([]pgtype.Text, error) FindTopScienceChildrenAgg(ctx context.Context) (pgtype.TextArray, error) // FindTopScienceChildrenAggBatch enqueues a FindTopScienceChildrenAgg query into batch to be executed // later by the batch. FindTopScienceChildrenAggBatch(batch genericBatch) // FindTopScienceChildrenAggScan scans the result of an executed FindTopScienceChildrenAggBatch query. FindTopScienceChildrenAggScan(results pgx.BatchResults) (pgtype.TextArray, error) InsertSampleData(ctx context.Context) (pgconn.CommandTag, error) // InsertSampleDataBatch enqueues a InsertSampleData query into batch to be executed // later by the batch. InsertSampleDataBatch(batch genericBatch) // InsertSampleDataScan scans the result of an executed InsertSampleDataBatch query. InsertSampleDataScan(results pgx.BatchResults) (pgconn.CommandTag, error) FindLtreeInput(ctx context.Context, inLtree pgtype.Text, inLtreeArray []string) (FindLtreeInputRow, error) // FindLtreeInputBatch enqueues a FindLtreeInput query into batch to be executed // later by the batch. FindLtreeInputBatch(batch genericBatch, inLtree pgtype.Text, inLtreeArray []string) // FindLtreeInputScan scans the result of an executed FindLtreeInputBatch query. FindLtreeInputScan(results pgx.BatchResults) (FindLtreeInputRow, error) }
Querier is a typesafe Go interface backed by SQL queries.
Methods ending with Batch enqueue a query to run later in a pgx.Batch. After calling SendBatch on pgx.Conn, pgxpool.Pool, or pgx.Tx, use the Scan methods to parse the results.
type QuerierConfig ¶
type QuerierConfig struct { // DataTypes contains pgtype.Value to use for encoding and decoding instead // of sqlgen-generated pgtype.ValueTranscoder. // // If OIDs are available for an input parameter type and all of its // transitive dependencies, sqlgen will use the binary encoding format for // the input parameter. DataTypes []pgtype.DataType }