mysqlx

package
v0.0.0-...-8529627 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMysqlConn

func NewMysqlConn(user, password, host, port, dbname string, maxPoolSize, maxIdle int) *gorm.DB

NewMysqlConn 创建Mysql链接

Types

type IDataSource

type IDataSource interface {
	Master(ctx context.Context) *gorm.DB
	Slave(ctx context.Context) *gorm.DB
	Close()
}

IDataSource 定义数据库数据源接口,按照业务需求可以返回主库链接Master和从库链接Slave

type Transaction

type Transaction interface {
	// Execute 执行一个事务方法,func为一个需要保证事务完整性的业务方法
	Execute(ctx context.Context, fn func(ctx context.Context) error) error
}

Transaction 事物接口

Jump to

Keyboard shortcuts

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