database

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRun added in v1.0.6

func GetRun()

Types

type Configure

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

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
}

func (*DBConfig) Init

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

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

type DBInfo added in v1.0.6

type DBInfo struct {
	DBType   string
	Host     string
	UserName string
	Password string
	Charset  string
}

type DBModel added in v1.0.6

type DBModel struct {
	DBEngine *sql.DB
	DBInfo   *DBInfo
}

func NewDBModel added in v1.0.6

func NewDBModel(info *DBInfo) *DBModel

func (*DBModel) ConnectDB added in v1.0.6

func (m *DBModel) ConnectDB(db string) error

func (*DBModel) GeRows added in v1.0.6

func (m *DBModel) GeRows() string

type DBResolverConfig

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

func (*DBResolverConfig) Init

type ResolverConfigure

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

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