postgres

package
v0.0.0-...-26754de Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PGStorage

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

func NewPGStorage

func NewPGStorage(logger *zap.Logger, cfg StorageConfig) (*PGStorage, error)

NewPGStorage TODO: write mock

func (*PGStorage) Close

func (s *PGStorage) Close() error

func (*PGStorage) Master

func (s *PGStorage) Master() *sqlx.DB

func (*PGStorage) Slave

func (s *PGStorage) Slave() *sqlx.DB

type StorageConfig

type StorageConfig struct {
	EnableMock            bool          `yaml:"enable_mock"`
	Hosts                 []string      `yaml:"hosts"`
	Port                  int           `yaml:"port"`
	Database              string        `yaml:"database"`
	Username              string        `yaml:"username"`
	Password              string        `yaml:"password" env:"DB_PASSWORD"`
	SSLMode               string        `yaml:"ssl_mode"`
	ConnectionAttempts    int           `yaml:"connection_attempts"`
	InitializationTimeout time.Duration `yaml:"initialization_timeout"`
}

func (*StorageConfig) Validate

func (c *StorageConfig) Validate() error

Jump to

Keyboard shortcuts

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