Documentation
¶
Index ¶
- func PrepareAllQueries(ctx context.Context, p preparer) error
- type DBQuerier
- func (q *DBQuerier) Backtick(ctx context.Context) (string, error)
- func (q *DBQuerier) BacktickBackslashN(ctx context.Context) (string, error)
- func (q *DBQuerier) BacktickBackslashNBatch(batch genericBatch)
- func (q *DBQuerier) BacktickBackslashNScan(results pgx.BatchResults) (string, error)
- func (q *DBQuerier) BacktickBatch(batch genericBatch)
- func (q *DBQuerier) BacktickDoubleQuote(ctx context.Context) (string, error)
- func (q *DBQuerier) BacktickDoubleQuoteBatch(batch genericBatch)
- func (q *DBQuerier) BacktickDoubleQuoteScan(results pgx.BatchResults) (string, error)
- func (q *DBQuerier) BacktickNewline(ctx context.Context) (string, error)
- func (q *DBQuerier) BacktickNewlineBatch(batch genericBatch)
- func (q *DBQuerier) BacktickNewlineScan(results pgx.BatchResults) (string, error)
- func (q *DBQuerier) BacktickQuoteBacktick(ctx context.Context) (string, error)
- func (q *DBQuerier) BacktickQuoteBacktickBatch(batch genericBatch)
- func (q *DBQuerier) BacktickQuoteBacktickScan(results pgx.BatchResults) (string, error)
- func (q *DBQuerier) BacktickScan(results pgx.BatchResults) (string, error)
- func (q *DBQuerier) BadEnumName(ctx context.Context) (UnnamedEnum123, error)
- func (q *DBQuerier) BadEnumNameBatch(batch genericBatch)
- func (q *DBQuerier) BadEnumNameScan(results pgx.BatchResults) (UnnamedEnum123, error)
- func (q *DBQuerier) GoKeyword(ctx context.Context, go_ string) (string, error)
- func (q *DBQuerier) GoKeywordBatch(batch genericBatch, go_ string)
- func (q *DBQuerier) GoKeywordScan(results pgx.BatchResults) (string, error)
- func (q *DBQuerier) IllegalNameSymbols(ctx context.Context, helloWorld string) (IllegalNameSymbolsRow, error)
- func (q *DBQuerier) IllegalNameSymbolsBatch(batch genericBatch, helloWorld string)
- func (q *DBQuerier) IllegalNameSymbolsScan(results pgx.BatchResults) (IllegalNameSymbolsRow, error)
- func (q *DBQuerier) SpaceAfter(ctx context.Context, space string) (string, error)
- func (q *DBQuerier) SpaceAfterBatch(batch genericBatch, space string)
- func (q *DBQuerier) SpaceAfterScan(results pgx.BatchResults) (string, error)
- func (q *DBQuerier) WithTx(tx pgx.Tx) (*DBQuerier, error)
- type IllegalNameSymbolsRow
- type Querier
- type QuerierConfig
- type UnnamedEnum123
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrepareAllQueries ¶
PrepareAllQueries executes a PREPARE statement for all pggen 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) BacktickBackslashN ¶
BacktickBackslashN implements Querier.BacktickBackslashN.
func (*DBQuerier) BacktickBackslashNBatch ¶
func (q *DBQuerier) BacktickBackslashNBatch(batch genericBatch)
BacktickBackslashNBatch implements Querier.BacktickBackslashNBatch.
func (*DBQuerier) BacktickBackslashNScan ¶
BacktickBackslashNScan implements Querier.BacktickBackslashNScan.
func (*DBQuerier) BacktickBatch ¶
func (q *DBQuerier) BacktickBatch(batch genericBatch)
BacktickBatch implements Querier.BacktickBatch.
func (*DBQuerier) BacktickDoubleQuote ¶
BacktickDoubleQuote implements Querier.BacktickDoubleQuote.
func (*DBQuerier) BacktickDoubleQuoteBatch ¶
func (q *DBQuerier) BacktickDoubleQuoteBatch(batch genericBatch)
BacktickDoubleQuoteBatch implements Querier.BacktickDoubleQuoteBatch.
func (*DBQuerier) BacktickDoubleQuoteScan ¶
BacktickDoubleQuoteScan implements Querier.BacktickDoubleQuoteScan.
func (*DBQuerier) BacktickNewline ¶
BacktickNewline implements Querier.BacktickNewline.
func (*DBQuerier) BacktickNewlineBatch ¶
func (q *DBQuerier) BacktickNewlineBatch(batch genericBatch)
BacktickNewlineBatch implements Querier.BacktickNewlineBatch.
func (*DBQuerier) BacktickNewlineScan ¶
BacktickNewlineScan implements Querier.BacktickNewlineScan.
func (*DBQuerier) BacktickQuoteBacktick ¶
BacktickQuoteBacktick implements Querier.BacktickQuoteBacktick.
func (*DBQuerier) BacktickQuoteBacktickBatch ¶
func (q *DBQuerier) BacktickQuoteBacktickBatch(batch genericBatch)
BacktickQuoteBacktickBatch implements Querier.BacktickQuoteBacktickBatch.
func (*DBQuerier) BacktickQuoteBacktickScan ¶
BacktickQuoteBacktickScan implements Querier.BacktickQuoteBacktickScan.
func (*DBQuerier) BacktickScan ¶
BacktickScan implements Querier.BacktickScan.
func (*DBQuerier) BadEnumName ¶
func (q *DBQuerier) BadEnumName(ctx context.Context) (UnnamedEnum123, error)
BadEnumName implements Querier.BadEnumName.
func (*DBQuerier) BadEnumNameBatch ¶
func (q *DBQuerier) BadEnumNameBatch(batch genericBatch)
BadEnumNameBatch implements Querier.BadEnumNameBatch.
func (*DBQuerier) BadEnumNameScan ¶
func (q *DBQuerier) BadEnumNameScan(results pgx.BatchResults) (UnnamedEnum123, error)
BadEnumNameScan implements Querier.BadEnumNameScan.
func (*DBQuerier) GoKeywordBatch ¶
GoKeywordBatch implements Querier.GoKeywordBatch.
func (*DBQuerier) GoKeywordScan ¶
GoKeywordScan implements Querier.GoKeywordScan.
func (*DBQuerier) IllegalNameSymbols ¶
func (q *DBQuerier) IllegalNameSymbols(ctx context.Context, helloWorld string) (IllegalNameSymbolsRow, error)
IllegalNameSymbols implements Querier.IllegalNameSymbols.
func (*DBQuerier) IllegalNameSymbolsBatch ¶
IllegalNameSymbolsBatch implements Querier.IllegalNameSymbolsBatch.
func (*DBQuerier) IllegalNameSymbolsScan ¶
func (q *DBQuerier) IllegalNameSymbolsScan(results pgx.BatchResults) (IllegalNameSymbolsRow, error)
IllegalNameSymbolsScan implements Querier.IllegalNameSymbolsScan.
func (*DBQuerier) SpaceAfter ¶
SpaceAfter implements Querier.SpaceAfter.
func (*DBQuerier) SpaceAfterBatch ¶
SpaceAfterBatch implements Querier.SpaceAfterBatch.
func (*DBQuerier) SpaceAfterScan ¶
SpaceAfterScan implements Querier.SpaceAfterScan.
type IllegalNameSymbolsRow ¶
type Querier ¶
type Querier interface { // Query to test escaping in generated Go. Backtick(ctx context.Context) (string, error) // BacktickBatch enqueues a Backtick query into batch to be executed // later by the batch. BacktickBatch(batch genericBatch) // BacktickScan scans the result of an executed BacktickBatch query. BacktickScan(results pgx.BatchResults) (string, error) // Query to test escaping in generated Go. BacktickQuoteBacktick(ctx context.Context) (string, error) // BacktickQuoteBacktickBatch enqueues a BacktickQuoteBacktick query into batch to be executed // later by the batch. BacktickQuoteBacktickBatch(batch genericBatch) // BacktickQuoteBacktickScan scans the result of an executed BacktickQuoteBacktickBatch query. BacktickQuoteBacktickScan(results pgx.BatchResults) (string, error) // Query to test escaping in generated Go. BacktickNewline(ctx context.Context) (string, error) // BacktickNewlineBatch enqueues a BacktickNewline query into batch to be executed // later by the batch. BacktickNewlineBatch(batch genericBatch) // BacktickNewlineScan scans the result of an executed BacktickNewlineBatch query. BacktickNewlineScan(results pgx.BatchResults) (string, error) // Query to test escaping in generated Go. BacktickDoubleQuote(ctx context.Context) (string, error) // BacktickDoubleQuoteBatch enqueues a BacktickDoubleQuote query into batch to be executed // later by the batch. BacktickDoubleQuoteBatch(batch genericBatch) // BacktickDoubleQuoteScan scans the result of an executed BacktickDoubleQuoteBatch query. BacktickDoubleQuoteScan(results pgx.BatchResults) (string, error) // Query to test escaping in generated Go. BacktickBackslashN(ctx context.Context) (string, error) // BacktickBackslashNBatch enqueues a BacktickBackslashN query into batch to be executed // later by the batch. BacktickBackslashNBatch(batch genericBatch) // BacktickBackslashNScan scans the result of an executed BacktickBackslashNBatch query. BacktickBackslashNScan(results pgx.BatchResults) (string, error) // Illegal names. IllegalNameSymbols(ctx context.Context, helloWorld string) (IllegalNameSymbolsRow, error) // IllegalNameSymbolsBatch enqueues a IllegalNameSymbols query into batch to be executed // later by the batch. IllegalNameSymbolsBatch(batch genericBatch, helloWorld string) // IllegalNameSymbolsScan scans the result of an executed IllegalNameSymbolsBatch query. IllegalNameSymbolsScan(results pgx.BatchResults) (IllegalNameSymbolsRow, error) // Space after pggen.arg SpaceAfter(ctx context.Context, space string) (string, error) // SpaceAfterBatch enqueues a SpaceAfter query into batch to be executed // later by the batch. SpaceAfterBatch(batch genericBatch, space string) // SpaceAfterScan scans the result of an executed SpaceAfterBatch query. SpaceAfterScan(results pgx.BatchResults) (string, error) // Enum named 123. BadEnumName(ctx context.Context) (UnnamedEnum123, error) // BadEnumNameBatch enqueues a BadEnumName query into batch to be executed // later by the batch. BadEnumNameBatch(batch genericBatch) // BadEnumNameScan scans the result of an executed BadEnumNameBatch query. BadEnumNameScan(results pgx.BatchResults) (UnnamedEnum123, error) GoKeyword(ctx context.Context, go_ string) (string, error) // GoKeywordBatch enqueues a GoKeyword query into batch to be executed // later by the batch. GoKeywordBatch(batch genericBatch, go_ string) // GoKeywordScan scans the result of an executed GoKeywordBatch query. GoKeywordScan(results pgx.BatchResults) (string, 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 pggen-generated pgtype.ValueTranscoder. // // If OIDs are available for an input parameter type and all of its // transitive dependencies, pggen will use the binary encoding format for // the input parameter. DataTypes []pgtype.DataType }
type UnnamedEnum123 ¶
type UnnamedEnum123 string
UnnamedEnum123 represents the Postgres enum "123".
const ( UnnamedEnum123InconvertibleEnumName UnnamedEnum123 = "inconvertible_enum_name" UnnamedEnum123UnnamedLabel1 UnnamedEnum123 = "" UnnamedEnum123UnnamedLabel2111 UnnamedEnum123 = "111" UnnamedEnum123UnnamedLabel3 UnnamedEnum123 = "!!" )
func (UnnamedEnum123) String ¶
func (u UnnamedEnum123) String() string