sql

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2025 License: Apache-2.0 Imports: 4 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       Name `yaml:"Name"`
	Postgresql PostgresqlConfig
}

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 Name

type Name string
const (
	MySQL    Name = "mysql"
	Postgres Name = "postgres"
)

type PostgresqlConfig

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

Jump to

Keyboard shortcuts

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