Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Commands ¶
type Commands interface {
CommandsReader
CommandsWriter
}
Commands exposes all queries in its generated store group.
type CommandsReader ¶
type CommandsReader interface {
// BatchGetCommandUser executes the generated BatchGetCommandUser query.
BatchGetCommandUser(ctx context.Context, id []int64, storeOptions ...QueryOption) *db.BatchGetCommandUserBatchResults
// BatchListCommandUsersByTenant executes the generated BatchListCommandUsersByTenant query.
BatchListCommandUsersByTenant(ctx context.Context, tenantID []int64, storeOptions ...QueryOption) *db.BatchListCommandUsersByTenantBatchResults
// GetCommandUser executes the generated GetCommandUser query.
GetCommandUser(ctx context.Context, id int64, storeOptions ...QueryOption) (*db.User, error)
// ListCommandUsers executes the generated ListCommandUsers query.
ListCommandUsers(ctx context.Context, storeOptions ...QueryOption) ([]*db.User, error)
}
CommandsReader exposes read queries in the Commands store group.
type CommandsWriter ¶
type CommandsWriter interface {
// BatchInsertCommandUsers executes the generated BatchInsertCommandUsers query.
BatchInsertCommandUsers(ctx context.Context, arg []*db.BatchInsertCommandUsersParams, storeOptions ...QueryOption) *db.BatchInsertCommandUsersBatchResults
// CopyCommandUsers executes the generated CopyCommandUsers query.
CopyCommandUsers(ctx context.Context, arg []*db.CopyCommandUsersParams, storeOptions ...QueryOption) (int64, error)
// DeleteCommandUser executes the generated DeleteCommandUser query.
DeleteCommandUser(ctx context.Context, id int64, storeOptions ...QueryOption) error
// DeleteCommandUsersByTenant executes the generated DeleteCommandUsersByTenant query.
DeleteCommandUsersByTenant(ctx context.Context, tenantID int64, storeOptions ...QueryOption) (int64, error)
// TouchCommandUser executes the generated TouchCommandUser query.
TouchCommandUser(ctx context.Context, id int64, storeOptions ...QueryOption) (pgconn.CommandTag, error)
}
CommandsWriter exposes write queries in the Commands store group.
type QueryOption ¶
type QueryOption func(*queryOptions)
QueryOption customizes routing for one generated query call.
func ReadFromPrimary ¶
func ReadFromPrimary() QueryOption
ReadFromPrimary routes a read query to the primary database.
func WithTx ¶
func WithTx(tx pgx.Tx) QueryOption
WithTx executes a query through tx and suppresses write mirrors.
type SingletonOption ¶
type SingletonOption func(*singletonConfig)
SingletonOption customizes a single-database topology.
func WithDatabaseName ¶
func WithDatabaseName(name string) SingletonOption
WithDatabaseName identifies the database in telemetry. An empty name defaults to "default".
func WithReadReplicas ¶
func WithReadReplicas(databases ...db.DBTX) SingletonOption
WithReadReplicas appends databases used for round-robin reads.
func WithWriteMirrors ¶
func WithWriteMirrors(databases ...db.DBTX) SingletonOption
WithWriteMirrors appends databases that synchronously receive writes.
type Store ¶
type Store interface {
// Commands returns the Commands query group.
Commands() Commands
}
Store is the topology-independent generated query API.
type StoreOption ¶
type StoreOption func(*storeOptions)
StoreOption customizes telemetry for a generated store.
func WithLogger ¶
func WithLogger(logger *slog.Logger) StoreOption
WithLogger configures optional structured logging for routed queries. A nil logger disables logging.
func WithMeterProvider ¶
func WithMeterProvider(provider metric.MeterProvider) StoreOption
WithMeterProvider configures the provider used for routed query metrics. A nil provider uses the global OpenTelemetry meter provider.
func WithTracerProvider ¶
func WithTracerProvider(provider trace.TracerProvider) StoreOption
WithTracerProvider configures the provider used for routed query spans. A nil provider uses the global OpenTelemetry tracer provider.