Documentation
¶
Overview ¶
Package stdpgxfx provides sql.DB connection pools usng pgx/v5.
Index ¶
- func Provide[DBT any](drv Driver[DBT], mainPoolName string, derivedPoolNames ...string) fx.Option
- func ProvideDeriver(name string, deriver Deriver) fx.Option
- func TestProvide[DBT any](tb testing.TB, mig pgtestdb.Migrator, drv Driver[DBT], mainPoolName string, ...) fx.Option
- type Config
- type Deriver
- type Driver
- type EndRole
- type Params
- type PgtestdbTestMigratorParams
- type Result
- type TestMigrator
- type TestMigratorFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProvideDeriver ¶ added in v0.0.13
ProvideDeriver is a short-hande function for providing a named deriver function that.
Types ¶
type Config ¶
type Config struct { // MainDatabaseURL configures the database connection string for the main connection. MainDatabaseURL string `env:"MAIN_DATABASE_URL,required"` // IamAuthRegion when set cause the password to be replaced by an IAM token for authentication. IamAuthRegion string `env:"IAM_AUTH_REGION"` }
Config configures the module.
type Deriver ¶ added in v0.0.13
Deriver needs to be provided by the user of this module if derived pools are created.
type Driver ¶ added in v0.0.117
Driver abstracts turning a pgxpool config into connection pool and closing it.
func NewPgxV5Driver ¶ added in v0.0.117
NewPgxV5Driver inits a driver that uses the pgx v5 pooling.
func NewStandardDriver ¶ added in v0.0.117
NewStandardDriver inits a driver that uses the standard lib sql.DB as a pool.
type EndRole ¶ added in v0.0.120
EndRole defines a type that can be provided if the role that actually connects to the database in tests is different from the migration role.
type PgtestdbTestMigratorParams ¶ added in v0.0.58
type TestMigrator ¶ added in v0.0.58
type TestMigrator interface { Migrate( tb testing.TB, cfg Config, pcfg *pgxpool.Config, ) (*pgxpool.Config, error) }
TestMigrator can be implemented and provided to migrate the database for tests.
func NewPgtestdbTestMigrator ¶ added in v0.0.58
func NewPgtestdbTestMigrator(params PgtestdbTestMigratorParams) TestMigrator
NewPgtestdbTestMigrator implements the TestMigrator using the pgtestdb library.