database

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGormClient

func NewGormClient(config *Config, opts ...Option) (*gorm.DB, error)

func NewGormLogger

func NewGormLogger(l *zerolog.Logger) *logger

func NewSqlxClient

func NewSqlxClient(config *Config, opts ...Option) (*mssqlx.DBs, error)

Types

type ClientManager

type ClientManager interface {
	GetClient(string) *gorm.DB
	GetGormClient(string) *gorm.DB
	GetSqlxClient(string) *mssqlx.DBs
}

func NewClientManager

func NewClientManager(configs []Config, opts ...Option) (ClientManager, error)

type Config

type Config struct {
	Name     string   `json:"name"`
	Database string   `json:"database"`
	User     string   `json:"user"`
	Password string   `json:"password"`
	Masters  []string `json:"masters"`
	Slaves   []string `json:"slaves"`
}

type GormClient

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

func (*GormClient) DB

func (c *GormClient) DB() *gorm.DB

type MssqlxClient

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

func (*MssqlxClient) DB

func (c *MssqlxClient) DB() *mssqlx.DBs

type Option

type Option func(*options)

func WithLogger

func WithLogger(logger *zerolog.Logger) Option

Jump to

Keyboard shortcuts

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