startup_postgres

package
v2.3.32 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrIsForeignKeyViolation

func ErrIsForeignKeyViolation(err error) bool

func ErrIsUniqueViolation

func ErrIsUniqueViolation(err error) bool

func InstallTracer added in v2.2.106

func InstallTracer(tracer Tracer)

Types

type Initializer

type Initializer func(db *sqlx.DB) error

func DefaultMigration

func DefaultMigration(table string) Initializer

DefaultMigration creates an Initializer that performs a database migration by looking for sql files in the default directories.

func Migration

func Migration(table, directory string) Initializer

Migration Runs a migration with the sql files from the given directory. The directory must exist. The migration library will use the given table name to store the migration progress

type PostgresOptions

type PostgresOptions struct {
	URL      string `long:"postgres" default:"postgres://postgres:postgres@localhost:5432?sslmode=disable" description:"Postgres server url."`
	PoolSize int    `` /* 133-byte string literal not displayed */

	ConnectionLifetime time.Duration `long:"postgres-lifetime" default:"10m" description:"Maximum time a connection in the pool can be used."`

	Inputs struct {
		// An optional initializer. This might be used to do
		// database migration or stuff.
		Initializer Initializer
	}
	// contains filtered or unexported fields
}

func (*PostgresOptions) Connection

func (opts *PostgresOptions) Connection() *sqlx.DB

func (*PostgresOptions) StartVacuumTask

func (opts *PostgresOptions) StartVacuumTask(db *sqlx.DB, table string, interval time.Duration, clock clock.Clock) io.Closer

type Tracer added in v2.2.106

type Tracer interface {
	pgx.QueryTracer
	pgx.PrepareTracer
	pgx.ConnectTracer

	TransactionStart(ctx context.Context) context.Context
	TransactionEnd(ctx context.Context)
}

func GetTracer added in v2.2.106

func GetTracer() Tracer

Jump to

Keyboard shortcuts

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