confpostgres

package
v1.4.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SwitchSlave

func SwitchSlave(executor sqlx.DBExecutor) sqlx.DBExecutor

Types

type CanSlave

type CanSlave interface {
	UseSlave() sqlx.DBExecutor
}

type Postgres

type Postgres struct {
	Host            string
	SlaveHost       string
	Port            int
	User            string
	Password        envconfig.Password
	Extra           string
	Extensions      []string
	PoolSize        int
	ConnMaxLifetime envconfig.Duration
	Database        *sqlx.Database `ignored:"true"`

	*sqlx.DB `ignored:"true"`
	// contains filtered or unexported fields
}

func (*Postgres) Init

func (m *Postgres) Init()

func (*Postgres) LivenessCheck

func (m *Postgres) LivenessCheck() map[string]string

func (*Postgres) SetDefaults

func (m *Postgres) SetDefaults()

func (*Postgres) UseSlave

func (m *Postgres) UseSlave() sqlx.DBExecutor

type PostgresEndpoint

type PostgresEndpoint struct {
	Endpoint envconfig.Endpoint `env:""`
	Database *sqlx.Database     `env:"-"`

	Extensions      []string
	PoolSize        int
	ConnMaxLifetime envconfig.Duration

	*sqlx.DB `env:"-"`
}

func (*PostgresEndpoint) Init

func (m *PostgresEndpoint) Init()

func (*PostgresEndpoint) LivenessCheck

func (m *PostgresEndpoint) LivenessCheck() map[string]string

func (*PostgresEndpoint) SetDefaults

func (m *PostgresEndpoint) SetDefaults()

type Retry

type Retry struct {
	Repeats  int
	Interval envconfig.Duration
}

func (Retry) Do

func (r Retry) Do(exec func() error) (err error)

func (*Retry) SetDefaults

func (r *Retry) SetDefaults()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL