psql

package
v0.0.0-...-c194919 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: Unlicense Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	URLEnvKey           string    `yaml:"url_env_key" default:"PG_URL"`
	DBNameEnvKey        string    `yaml:"db_name_env_key" default:"PG_DATABASE"`
	URLParametersEnvKey string    `yaml:"url_parameters_env_key" default:"PG_URL_PARAMETERS"`
	Migration           Migration `yaml:"migration"`
	Pool                Pool      `yaml:"pool"`
	Host                string    `yaml:"host"`
	Port                string    `yaml:"port"`
	SSLMode             string    `yaml:"sslmode"`
}

Config - Postgresql config

type Migration

type Migration struct {
	Source          string `yaml:"source"`
	Attempts        int    `yaml:"attempts"`
	AttemptsTimeout int    `yaml:"attempts_timeout"`
	Enable          bool   `yaml:"enable"`
}

type Pool

type Pool struct {
	MaxPoolSize        int `yaml:"max_pool_size"`
	MinPoolSize        int `yaml:"min_pool_size"`
	ConnectionAttempts int `yaml:"connection_attempts"`
	ConnectionTimeout  int `yaml:"connection_timeout"`
}

Pool - Pool config

type Psql

type Psql struct {
	// contains filtered or unexported fields
}

func NewPsql

func NewPsql(ctx context.Context, cfg *Config, stop <-chan struct{}, log *logrus.Logger) (*Psql, error)

func (*Psql) GetDatabaseName

func (p *Psql) GetDatabaseName() string

func (*Psql) GetDatabaseURL

func (p *Psql) GetDatabaseURL(options ...string) string

func (*Psql) GetMigrationAttempts

func (p *Psql) GetMigrationAttempts() (int, time.Duration)

func (*Psql) GetMigrationSource

func (p *Psql) GetMigrationSource() string

func (*Psql) GetPool

func (p *Psql) GetPool() *pgxpool.Pool

func (*Psql) GetQueryBuilder

func (p *Psql) GetQueryBuilder() *squirrel.StatementBuilderType

func (*Psql) IsMigrationEnabled

func (p *Psql) IsMigrationEnabled() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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