database

package
v1.7.13 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 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