sql

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: Apache-2.0 Imports: 5 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 {
	Name     databases.DatabaseName `yaml:"Name"`
	Postgres PostgresConfig         `yaml:"Postgres"`
}

type DBManager

type DBManager interface {
	// Primary returns the primary database connection.
	Primary() *sql.DB
	// Replica returns the random replica database connection.
	// eventually distribution will be equal
	Replica() *sql.DB
}

func NewDBManager

func NewDBManager(cfg *Config) (DBManager, error)

NewDBManager creates a new DBManager based on the provided configuration.

type DBManagerImpl

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

func (*DBManagerImpl) Primary

func (d *DBManagerImpl) Primary() *sql.DB

func (*DBManagerImpl) Replica

func (d *DBManagerImpl) Replica() *sql.DB

type PostgresConfig added in v1.3.4

type PostgresConfig struct {
	Primary pgsql.Config
	Replica []pgsql.Config
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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