pgboot

package
v0.0.0-...-3c51467 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Postgres

type Postgres struct {
	MigrationsDir string // relative path to migrations directory, leave empty when no migrations

	DB *sqlx.DB
	// contains filtered or unexported fields
}

Postgres implements the AppService interface.

func (*Postgres) Close

func (s *Postgres) Close() error

func (*Postgres) Configure

func (s *Postgres) Configure(env *goboot.AppEnv) error

Configure connects to postgres.

func (*Postgres) Init

func (s *Postgres) Init() error

func (*Postgres) Migrate

func (s *Postgres) Migrate(dsn string, migrations string) error

Migrate runs Postgres migration files from specified migrations directory.

Panics if anything went wrong.

func (*Postgres) Name

func (s *Postgres) Name() string

type PostgresConfig

type PostgresConfig struct {
	// DSN contains the PGX data source name, e.;g. postgres://user:password@host:port/dbname?query
	// see also https://github.com/golang-migrate/migrate/tree/master/database/pgx
	DSN string `yaml:"dsn"`

	// Number of retries upon initial connect. Default is 5 times. Set -1 to disable
	ConnectMaxRetries int `yaml:"connectMaxRetries"`

	// Time between retries for initial connect attempts. Default is 5 seconds.
	ConnectRetryDuration time.Duration `yaml:"connectRetryDuration"`
}

type PostgresMigratePrinter

type PostgresMigratePrinter interface {
	Printf(format string, v ...any)
}

Jump to

Keyboard shortcuts

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