database

package
v0.0.0-...-f61a1b2 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Reset       = "\033[0m"
	Red         = "\033[31m"
	Green       = "\033[32m"
	Yellow      = "\033[33m"
	Blue        = "\033[34m"
	Magenta     = "\033[35m"
	Cyan        = "\033[36m"
	White       = "\033[37m"
	BlueBold    = "\033[34;1m"
	MagentaBold = "\033[35;1m"
	RedBold     = "\033[31;1m"
	YellowBold  = "\033[33;1m"
)

Colors

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(config logger.Config) logger.Interface

NewLogger new a logger interface

Types

type Configure

type Configure interface {
	Init(*gorm.Config, func(string) gorm.Dialector) (*gorm.DB, error)
}

Configure config interface

func NewConfigure

func NewConfigure(
	dsn string,
	maxIdleConns,
	maxOpenConns,
	connMaxIdleTime,
	connMaxLifetime int,
	registers []ResolverConfigure) Configure

NewConfigure 初始化 Configure

type DBConfig

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

DBConfig db config

func (*DBConfig) Init

func (e *DBConfig) Init(config *gorm.Config, open func(string) gorm.Dialector) (*gorm.DB, error)

Init 获取db,⚠️注意:读写分离只能配置一组

type DBResolverConfig

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

DBResolverConfig db resolver config

func (*DBResolverConfig) Init

Init init

type ResolverConfigure

type ResolverConfigure interface {
	Init(*dbresolver.DBResolver, func(string) gorm.Dialector) *dbresolver.DBResolver
}

ResolverConfigure resolver config interface

func NewResolverConfigure

func NewResolverConfigure(sources, replicas []string, policy string, tables []string) ResolverConfigure

NewResolverConfigure 初始化 ResolverConfigure

Jump to

Keyboard shortcuts

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