Documentation
¶
Overview ¶
Package postgres wires the Postgres-backed store implementations into the application via uber-go/fx.
Index ¶
- Variables
- func NewAccessKeyStore(mdb *MigratedPool) accesskey.Store
- func NewBucketStore(mdb *MigratedPool) bucket.Store
- func NewDelegationStore(mdb *MigratedPool) delegation.Store
- func NewPostgresPool(cfg config.PostgresConfig, lc fx.Lifecycle, logger *zap.Logger) (*pgxpool.Pool, error)
- func NewProviderStore(mdb *MigratedPool) provider.Store
- func NewTenantStore(mdb *MigratedPool) tenant.Store
- type MigratedPool
Constants ¶
This section is empty.
Variables ¶
var Module = fx.Module("postgres-store", fx.Provide( NewPostgresPool, NewMigratedPool, NewAccessKeyStore, NewBucketStore, NewDelegationStore, NewProviderStore, NewTenantStore, ), )
Module provides the Postgres-backed store implementations.
Functions ¶
func NewAccessKeyStore ¶
func NewAccessKeyStore(mdb *MigratedPool) accesskey.Store
func NewBucketStore ¶
func NewBucketStore(mdb *MigratedPool) bucket.Store
func NewDelegationStore ¶
func NewDelegationStore(mdb *MigratedPool) delegation.Store
func NewPostgresPool ¶
func NewPostgresPool(cfg config.PostgresConfig, lc fx.Lifecycle, logger *zap.Logger) (*pgxpool.Pool, error)
NewPostgresPool creates a pgx connection pool and registers a lifecycle hook to ping on start and close it at shutdown.
func NewProviderStore ¶
func NewProviderStore(mdb *MigratedPool) provider.Store
func NewTenantStore ¶
func NewTenantStore(mdb *MigratedPool) tenant.Store
Types ¶
type MigratedPool ¶
MigratedPool is a *pgxpool.Pool whose schema is guaranteed to be at the head migration revision by the time any store that depends on it is used. Store constructors depend on *MigratedPool rather than *pgxpool.Pool so the fx dependency graph orders NewMigratedPool's migration hook before the stores.
func NewMigratedPool ¶
func NewMigratedPool(lc fx.Lifecycle, cfg config.PostgresConfig, pool *pgxpool.Pool, logger *zap.Logger) *MigratedPool
NewMigratedPool registers an OnStart hook that runs goose migrations against the pool (unless storage.postgres.skip_migrations is true) and returns a *MigratedPool wrapper that store constructors depend on.