Documentation ¶
Index ¶
- func PrepareAllQueries(ctx context.Context, p preparer) error
- type ChannelConfigRow
- type DBQuerier
- func (q *DBQuerier) AddReaction(ctx context.Context, userID int64, messageID int64) (pgconn.CommandTag, error)
- func (q *DBQuerier) AddReactionBatch(batch genericBatch, userID int64, messageID int64)
- func (q *DBQuerier) AddReactionScan(results pgx.BatchResults) (pgconn.CommandTag, error)
- func (q *DBQuerier) ChannelConfig(ctx context.Context, channelID int64, guildID int64) (ChannelConfigRow, error)
- func (q *DBQuerier) ChannelConfigBatch(batch genericBatch, channelID int64, guildID int64)
- func (q *DBQuerier) ChannelConfigScan(results pgx.BatchResults) (ChannelConfigRow, error)
- func (q *DBQuerier) GetStarboard(ctx context.Context, messageID int64) (GetStarboardRow, error)
- func (q *DBQuerier) GetStarboardBatch(batch genericBatch, messageID int64)
- func (q *DBQuerier) GetStarboardScan(results pgx.BatchResults) (GetStarboardRow, error)
- func (q *DBQuerier) HasOverride(ctx context.Context, channelID int64) (bool, error)
- func (q *DBQuerier) HasOverrideBatch(batch genericBatch, channelID int64)
- func (q *DBQuerier) HasOverrideScan(results pgx.BatchResults) (bool, error)
- func (q *DBQuerier) InsertStarboard(ctx context.Context, params InsertStarboardParams) (InsertStarboardRow, error)
- func (q *DBQuerier) InsertStarboardBatch(batch genericBatch, params InsertStarboardParams)
- func (q *DBQuerier) InsertStarboardScan(results pgx.BatchResults) (InsertStarboardRow, error)
- func (q *DBQuerier) ReactionCount(ctx context.Context, messageID int64) (int64, error)
- func (q *DBQuerier) ReactionCountBatch(batch genericBatch, messageID int64)
- func (q *DBQuerier) ReactionCountScan(results pgx.BatchResults) (int64, error)
- func (q *DBQuerier) RemoveAllReactions(ctx context.Context, messageID int64) (pgconn.CommandTag, error)
- func (q *DBQuerier) RemoveAllReactionsBatch(batch genericBatch, messageID int64)
- func (q *DBQuerier) RemoveAllReactionsScan(results pgx.BatchResults) (pgconn.CommandTag, error)
- func (q *DBQuerier) RemoveReaction(ctx context.Context, userID int64, messageID int64) (pgconn.CommandTag, error)
- func (q *DBQuerier) RemoveReactionBatch(batch genericBatch, userID int64, messageID int64)
- func (q *DBQuerier) RemoveReactionScan(results pgx.BatchResults) (pgconn.CommandTag, error)
- func (q *DBQuerier) RemoveStarboard(ctx context.Context, messageID int64) (pgconn.CommandTag, error)
- func (q *DBQuerier) RemoveStarboardBatch(batch genericBatch, messageID int64)
- func (q *DBQuerier) RemoveStarboardScan(results pgx.BatchResults) (pgconn.CommandTag, error)
- func (q *DBQuerier) StarboardMessage(ctx context.Context, id int64) (StarboardMessageRow, error)
- func (q *DBQuerier) StarboardMessageBatch(batch genericBatch, id int64)
- func (q *DBQuerier) StarboardMessageScan(results pgx.BatchResults) (StarboardMessageRow, error)
- func (q *DBQuerier) WithTx(tx pgx.Tx) (*DBQuerier, error)
- type GetStarboardRow
- type InsertStarboardParams
- type InsertStarboardRow
- type Querier
- type QuerierConfig
- type StarboardMessageRow
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 ChannelConfigRow ¶
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) AddReaction ¶
func (q *DBQuerier) AddReaction(ctx context.Context, userID int64, messageID int64) (pgconn.CommandTag, error)
AddReaction implements Querier.AddReaction.
func (*DBQuerier) AddReactionBatch ¶
AddReactionBatch implements Querier.AddReactionBatch.
func (*DBQuerier) AddReactionScan ¶
func (q *DBQuerier) AddReactionScan(results pgx.BatchResults) (pgconn.CommandTag, error)
AddReactionScan implements Querier.AddReactionScan.
func (*DBQuerier) ChannelConfig ¶
func (q *DBQuerier) ChannelConfig(ctx context.Context, channelID int64, guildID int64) (ChannelConfigRow, error)
ChannelConfig implements Querier.ChannelConfig.
func (*DBQuerier) ChannelConfigBatch ¶
ChannelConfigBatch implements Querier.ChannelConfigBatch.
func (*DBQuerier) ChannelConfigScan ¶
func (q *DBQuerier) ChannelConfigScan(results pgx.BatchResults) (ChannelConfigRow, error)
ChannelConfigScan implements Querier.ChannelConfigScan.
func (*DBQuerier) GetStarboard ¶
GetStarboard implements Querier.GetStarboard.
func (*DBQuerier) GetStarboardBatch ¶
GetStarboardBatch implements Querier.GetStarboardBatch.
func (*DBQuerier) GetStarboardScan ¶
func (q *DBQuerier) GetStarboardScan(results pgx.BatchResults) (GetStarboardRow, error)
GetStarboardScan implements Querier.GetStarboardScan.
func (*DBQuerier) HasOverride ¶
HasOverride implements Querier.HasOverride.
func (*DBQuerier) HasOverrideBatch ¶
HasOverrideBatch implements Querier.HasOverrideBatch.
func (*DBQuerier) HasOverrideScan ¶
HasOverrideScan implements Querier.HasOverrideScan.
func (*DBQuerier) InsertStarboard ¶
func (q *DBQuerier) InsertStarboard(ctx context.Context, params InsertStarboardParams) (InsertStarboardRow, error)
InsertStarboard implements Querier.InsertStarboard.
func (*DBQuerier) InsertStarboardBatch ¶
func (q *DBQuerier) InsertStarboardBatch(batch genericBatch, params InsertStarboardParams)
InsertStarboardBatch implements Querier.InsertStarboardBatch.
func (*DBQuerier) InsertStarboardScan ¶
func (q *DBQuerier) InsertStarboardScan(results pgx.BatchResults) (InsertStarboardRow, error)
InsertStarboardScan implements Querier.InsertStarboardScan.
func (*DBQuerier) ReactionCount ¶
ReactionCount implements Querier.ReactionCount.
func (*DBQuerier) ReactionCountBatch ¶
ReactionCountBatch implements Querier.ReactionCountBatch.
func (*DBQuerier) ReactionCountScan ¶
ReactionCountScan implements Querier.ReactionCountScan.
func (*DBQuerier) RemoveAllReactions ¶
func (q *DBQuerier) RemoveAllReactions(ctx context.Context, messageID int64) (pgconn.CommandTag, error)
RemoveAllReactions implements Querier.RemoveAllReactions.
func (*DBQuerier) RemoveAllReactionsBatch ¶
RemoveAllReactionsBatch implements Querier.RemoveAllReactionsBatch.
func (*DBQuerier) RemoveAllReactionsScan ¶
func (q *DBQuerier) RemoveAllReactionsScan(results pgx.BatchResults) (pgconn.CommandTag, error)
RemoveAllReactionsScan implements Querier.RemoveAllReactionsScan.
func (*DBQuerier) RemoveReaction ¶
func (q *DBQuerier) RemoveReaction(ctx context.Context, userID int64, messageID int64) (pgconn.CommandTag, error)
RemoveReaction implements Querier.RemoveReaction.
func (*DBQuerier) RemoveReactionBatch ¶
RemoveReactionBatch implements Querier.RemoveReactionBatch.
func (*DBQuerier) RemoveReactionScan ¶
func (q *DBQuerier) RemoveReactionScan(results pgx.BatchResults) (pgconn.CommandTag, error)
RemoveReactionScan implements Querier.RemoveReactionScan.
func (*DBQuerier) RemoveStarboard ¶
func (q *DBQuerier) RemoveStarboard(ctx context.Context, messageID int64) (pgconn.CommandTag, error)
RemoveStarboard implements Querier.RemoveStarboard.
func (*DBQuerier) RemoveStarboardBatch ¶
RemoveStarboardBatch implements Querier.RemoveStarboardBatch.
func (*DBQuerier) RemoveStarboardScan ¶
func (q *DBQuerier) RemoveStarboardScan(results pgx.BatchResults) (pgconn.CommandTag, error)
RemoveStarboardScan implements Querier.RemoveStarboardScan.
func (*DBQuerier) StarboardMessage ¶
StarboardMessage implements Querier.StarboardMessage.
func (*DBQuerier) StarboardMessageBatch ¶
StarboardMessageBatch implements Querier.StarboardMessageBatch.
func (*DBQuerier) StarboardMessageScan ¶
func (q *DBQuerier) StarboardMessageScan(results pgx.BatchResults) (StarboardMessageRow, error)
StarboardMessageScan implements Querier.StarboardMessageScan.
type GetStarboardRow ¶
type InsertStarboardParams ¶
type InsertStarboardRow ¶
type Querier ¶
type Querier interface { ChannelConfig(ctx context.Context, channelID int64, guildID int64) (ChannelConfigRow, error) // ChannelConfigBatch enqueues a ChannelConfig query into batch to be executed // later by the batch. ChannelConfigBatch(batch genericBatch, channelID int64, guildID int64) // ChannelConfigScan scans the result of an executed ChannelConfigBatch query. ChannelConfigScan(results pgx.BatchResults) (ChannelConfigRow, error) HasOverride(ctx context.Context, channelID int64) (bool, error) // HasOverrideBatch enqueues a HasOverride query into batch to be executed // later by the batch. HasOverrideBatch(batch genericBatch, channelID int64) // HasOverrideScan scans the result of an executed HasOverrideBatch query. HasOverrideScan(results pgx.BatchResults) (bool, error) StarboardMessage(ctx context.Context, id int64) (StarboardMessageRow, error) // StarboardMessageBatch enqueues a StarboardMessage query into batch to be executed // later by the batch. StarboardMessageBatch(batch genericBatch, id int64) // StarboardMessageScan scans the result of an executed StarboardMessageBatch query. StarboardMessageScan(results pgx.BatchResults) (StarboardMessageRow, error) AddReaction(ctx context.Context, userID int64, messageID int64) (pgconn.CommandTag, error) // AddReactionBatch enqueues a AddReaction query into batch to be executed // later by the batch. AddReactionBatch(batch genericBatch, userID int64, messageID int64) // AddReactionScan scans the result of an executed AddReactionBatch query. AddReactionScan(results pgx.BatchResults) (pgconn.CommandTag, error) RemoveReaction(ctx context.Context, userID int64, messageID int64) (pgconn.CommandTag, error) // RemoveReactionBatch enqueues a RemoveReaction query into batch to be executed // later by the batch. RemoveReactionBatch(batch genericBatch, userID int64, messageID int64) // RemoveReactionScan scans the result of an executed RemoveReactionBatch query. RemoveReactionScan(results pgx.BatchResults) (pgconn.CommandTag, error) ReactionCount(ctx context.Context, messageID int64) (int64, error) // ReactionCountBatch enqueues a ReactionCount query into batch to be executed // later by the batch. ReactionCountBatch(batch genericBatch, messageID int64) // ReactionCountScan scans the result of an executed ReactionCountBatch query. ReactionCountScan(results pgx.BatchResults) (int64, error) RemoveAllReactions(ctx context.Context, messageID int64) (pgconn.CommandTag, error) // RemoveAllReactionsBatch enqueues a RemoveAllReactions query into batch to be executed // later by the batch. RemoveAllReactionsBatch(batch genericBatch, messageID int64) // RemoveAllReactionsScan scans the result of an executed RemoveAllReactionsBatch query. RemoveAllReactionsScan(results pgx.BatchResults) (pgconn.CommandTag, error) RemoveStarboard(ctx context.Context, messageID int64) (pgconn.CommandTag, error) // RemoveStarboardBatch enqueues a RemoveStarboard query into batch to be executed // later by the batch. RemoveStarboardBatch(batch genericBatch, messageID int64) // RemoveStarboardScan scans the result of an executed RemoveStarboardBatch query. RemoveStarboardScan(results pgx.BatchResults) (pgconn.CommandTag, error) InsertStarboard(ctx context.Context, params InsertStarboardParams) (InsertStarboardRow, error) // InsertStarboardBatch enqueues a InsertStarboard query into batch to be executed // later by the batch. InsertStarboardBatch(batch genericBatch, params InsertStarboardParams) // InsertStarboardScan scans the result of an executed InsertStarboardBatch query. InsertStarboardScan(results pgx.BatchResults) (InsertStarboardRow, error) GetStarboard(ctx context.Context, messageID int64) (GetStarboardRow, error) // GetStarboardBatch enqueues a GetStarboard query into batch to be executed // later by the batch. GetStarboardBatch(batch genericBatch, messageID int64) // GetStarboardScan scans the result of an executed GetStarboardBatch query. GetStarboardScan(results pgx.BatchResults) (GetStarboardRow, 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 }