Documentation ¶
Index ¶
- type DbSplit
- func (sp *DbSplit) Close() error
- func (sp *DbSplit) Create(v interface{}) *gorm.DB
- func (sp *DbSplit) CreateWithContext(ctx context.Context, v interface{}) *gorm.DB
- func (sp *DbSplit) GetLogger() *GormLogger
- func (sp *DbSplit) Model(v interface{}) *gorm.DB
- func (sp *DbSplit) Read() *gorm.DB
- func (sp *DbSplit) ReadWithContext(ctx context.Context) *gorm.DB
- func (sp *DbSplit) Save(v interface{}) *gorm.DB
- func (sp *DbSplit) SaveWithContext(ctx context.Context, v interface{}) *gorm.DB
- func (sp *DbSplit) Table(v string) *gorm.DB
- func (sp *DbSplit) Transaction(fc func(tx *gorm.DB) error, opts ...*sql.TxOptions) error
- func (sp *DbSplit) TransactionWithContext(ctx context.Context, fc func(tx *gorm.DB) error, opts ...*sql.TxOptions) error
- func (sp *DbSplit) Write() *gorm.DB
- func (sp *DbSplit) WriteWithContext(ctx context.Context) *gorm.DB
- type GormLogger
- func (l *GormLogger) Error(ctx context.Context, format string, params ...interface{})
- func (l *GormLogger) Info(ctx context.Context, format string, params ...interface{})
- func (l *GormLogger) LogMode(level logger.LogLevel) logger.Interface
- func (l *GormLogger) SetTrace(...)
- func (l *GormLogger) SetTraceFunc(...)
- func (l *GormLogger) Trace(ctx context.Context, begin time.Time, ...)
- func (l *GormLogger) Warn(ctx context.Context, format string, params ...interface{})
- type MysqlConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DbSplit ¶
type DbSplit struct {
// contains filtered or unexported fields
}
func NewDbSplit ¶
func NewDbSplit(cfg MysqlConfig) *DbSplit
func (*DbSplit) CreateWithContext ¶
func (*DbSplit) GetLogger ¶
func (sp *DbSplit) GetLogger() *GormLogger
func (*DbSplit) SaveWithContext ¶
func (*DbSplit) Transaction ¶
func (*DbSplit) TransactionWithContext ¶
type GormLogger ¶
type GormLogger struct { logger.LogLevel TracerFunc func(ctx context.Context, begin time.Time, sql string, rowsAffected int64, err error) CallerSkip int }
func NewLog ¶
func NewLog(level string) *GormLogger
func (*GormLogger) Error ¶
func (l *GormLogger) Error(ctx context.Context, format string, params ...interface{})
func (*GormLogger) Info ¶
func (l *GormLogger) Info(ctx context.Context, format string, params ...interface{})
func (*GormLogger) SetTraceFunc ¶
type MysqlConfig ¶
type MysqlConfig struct { DataSourceWrite string // mysql链接地址,满足 $user:$password@tcp($ip:$port)/$db?$queries 格式即可 DataSourceRead string MaxConnIdle int `json:",default=20"` MaxIdleTime int64 `json:",default=3600"` MaxLeftTime int64 `json:",default=3600"` MaxOpen int `json:",default=30"` LogLevel string `json:",default=info"` }
Click to show internal directories.
Click to hide internal directories.