Documentation ¶
Index ¶
- Constants
- Variables
- func New(ctx context.Context, c DB) (gdb *gorm.DB, err error)
- func NewDialect(driver DBDriver, conn gorm.ConnPool) (gorm.Dialector, error)
- func NewGenTool(ctx context.Context, cfg DB, tables, outPath, pkgName string)
- func NewMysql(ctx context.Context, c DB) *gorm.DB
- type BinlogEvent
- type DB
- type DBConn
- type DBConnPool
- type DBDriver
- type DBResolver
- type DBResolverType
- type DTS
- type DbDsn
Constants ¶
View Source
const ( MySQL DBDriver = "mysql" Source DBResolverType = "source" Replica DBResolverType = "replica" )
Variables ¶
View Source
var ErrUnsupportedDriver = errors.New("unsupported database driver")
View Source
var ErrUnsupportedResolverType = errors.New("unsupported resolver type")
Functions ¶
Types ¶
type BinlogEvent ¶
type BinlogEvent struct { }
type DB ¶
type DB struct { Driver DBDriver `json:"driver" yaml:"driver"` Type DBResolverType `json:"-" yaml:"-"` Addr string `json:"addr" yaml:"addr"` Database string `json:"database" yaml:"database"` Username string `json:"username" yaml:"username"` Password string `json:"password" yaml:"password"` Options string `json:"options" yaml:"options"` MaxDialTimeout time.Duration `json:"maxDialTimeout" yaml:"maxDialTimeout"` MaxIdleConn int `json:"maxIdleConn" yaml:"maxIdleConn"` MaxOpenConn int `json:"maxOpenConn" yaml:"maxOpenConn"` ConnMaxIdleTime time.Duration `json:"connMaxIdleTime" yaml:"connMaxIdleTime"` ConnMaxLifeTime time.Duration `json:"connMaxLifeTime" yaml:"connMaxLifeTime"` LogInfo bool `json:"logInfo" yaml:"logInfo"` Resolvers []*DBResolver `json:"resolvers" yaml:"resolvers"` }
DB 数据库配置结构体
type DBConn ¶
type DBConn struct { Driver DBDriver `json:"driver" yaml:"driver"` Addr string `json:"addr" yaml:"addr"` Database string `json:"database" yaml:"database"` Username string `json:"username" yaml:"username"` Password string `json:"password" yaml:"password"` Options string `json:"options" yaml:"options"` MaxDialTimeout time.Duration `json:"maxDialTimeout" yaml:"maxDialTimeout"` MaxIdleConn int `json:"maxIdleConn" yaml:"maxIdleConn"` MaxOpenConn int `json:"maxOpenConn" yaml:"maxOpenConn"` ConnMaxIdleTime time.Duration `json:"connMaxIdleTime" yaml:"connMaxIdleTime"` ConnMaxLifeTime time.Duration `json:"connMaxLifeTime" yaml:"connMaxLifeTime"` }
DBConn 数据库连接配置结构体
type DBConnPool ¶
type DBConnPool struct { MaxIdleConn int `json:"maxIdleConn" yaml:"maxIdleConn"` MaxOpenConn int `json:"maxOpenConn" yaml:"maxOpenConn"` ConnMaxIdleTime time.Duration `json:"connMaxIdleTime" yaml:"connMaxIdleTime"` ConnMaxLifeTime time.Duration `json:"connMaxLifeTime" yaml:"connMaxLifeTime"` }
DBConnPool 数据库连接池配置
type DBResolver ¶
type DBResolver struct { Driver DBDriver `json:"-" yaml:"-"` Type DBResolverType `json:"type" yaml:"type"` Addr string `json:"addr" yaml:"addr"` Database string `json:"database" yaml:"database"` Username string `json:"username" yaml:"username"` Password string `json:"password" yaml:"password"` Options string `json:"options" yaml:"options"` MaxIdleConn int `json:"maxIdleConn" yaml:"maxIdleConn"` MaxOpenConn int `json:"maxOpenConn" yaml:"maxOpenConn"` ConnMaxIdleTime time.Duration `json:"connMaxIdleTime" yaml:"connMaxIdleTime"` ConnMaxLifeTime time.Duration `json:"connMaxLifeTime" yaml:"connMaxLifeTime"` }
DBResolver 数据库主从配置
type DBResolverType ¶
type DBResolverType string
func (DBResolverType) ToString ¶
func (r DBResolverType) ToString() string
type DbDsn ¶
type DbDsn struct { Driver DBDriver `json:"driver" yaml:"driver"` Addr string `json:"addr" yaml:"addr"` Database string `json:"database" yaml:"database"` Username string `json:"username" yaml:"username"` Password string `json:"password" yaml:"password"` Options string `json:"options" yaml:"options"` }
DbDsn 数据库DBS配置
Click to show internal directories.
Click to hide internal directories.