Documentation
¶
Index ¶
- func FromContext(ctx context.Context) sqlx.DBExecutor
- func SlaveFromContext(ctx context.Context) sqlx.DBExecutor
- func SwitchSlave(executor sqlx.DBExecutor) sqlx.DBExecutor
- func WithDB(db sqlx.DBExecutor) func(ctx context.Context) context.Context
- type CanSlave
- type Postgres
- type PostgresEndpoint
- type Retry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromContext ¶ added in v0.1.2
func SlaveFromContext ¶ added in v0.1.2
func SwitchSlave ¶ added in v0.1.2
func SwitchSlave(executor sqlx.DBExecutor) sqlx.DBExecutor
Types ¶
type Postgres ¶
type Postgres struct { Ctx context.Context DBName string `env:""` Host string `env:",upstream"` SlaveHost string `env:",upstream"` Port int `env:""` User string `env:""` Password envconf.Password `env:""` Extra string Extensions []string PoolSize int ConnMaxLifetime envconf.Duration Database *sqlx.Database `env:"-"` *sqlx.DB `env:"-"` // contains filtered or unexported fields }
func (*Postgres) LivenessCheck ¶ added in v0.1.2
func (*Postgres) SetDefaults ¶
func (m *Postgres) SetDefaults()
type PostgresEndpoint ¶ added in v0.1.2
type PostgresEndpoint struct { Endpoint envconf.Endpoint `env:""` SlaveEndpoint envconf.Endpoint `env:""` DBName string `env:",opt"` Database *sqlx.Database `env:"-"` Extensions []string PoolSize int ConnMaxLifetime envconf.Duration *sqlx.DB `env:"-"` // contains filtered or unexported fields }
func (*PostgresEndpoint) Init ¶ added in v0.1.2
func (m *PostgresEndpoint) Init()
func (*PostgresEndpoint) LivenessCheck ¶ added in v0.1.2
func (m *PostgresEndpoint) LivenessCheck() map[string]string
func (*PostgresEndpoint) SetDefaults ¶ added in v0.1.2
func (m *PostgresEndpoint) SetDefaults()
func (*PostgresEndpoint) UseSlave ¶ added in v0.1.2
func (m *PostgresEndpoint) UseSlave() sqlx.DBExecutor
Click to show internal directories.
Click to hide internal directories.