gorm

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*gorm.DB
}

Client gorm client

func NewClient

func NewClient(config *ConfigDefinition) (client *Client, err error)

NewClient new redis client

type ConfigDefinition

type ConfigDefinition struct {
	// 用户名称
	UserName string
	// 密码
	Password string
	// 数据库名
	Database string
	// 地址
	Url string
	// 相关参数
	Param string
	// 超时时间,要小于数据库的超时时间,单位(秒)
	ConnMaxLifetime time.Duration
	// 数据库的最大打开连接数
	MaxOpenConnNumber int
	// 空闲的最大连接数
	MaxIdleConnNumber int
}

ConfigDefinition gorm配置信息

type Logger added in v1.0.3

type Logger struct {
	SlowThreshold             time.Duration
	Colorful                  bool
	IgnoreRecordNotFoundError bool
}

func (*Logger) Error added in v1.0.3

func (l *Logger) Error(ctx context.Context, s string, i ...interface{})

func (*Logger) Info added in v1.0.3

func (l *Logger) Info(ctx context.Context, s string, i ...interface{})

func (*Logger) LogMode added in v1.0.3

func (l *Logger) LogMode(level logger.LogLevel) logger.Interface

func (*Logger) Trace added in v1.0.3

func (l *Logger) Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error)

func (*Logger) Warn added in v1.0.3

func (l *Logger) Warn(ctx context.Context, s string, i ...interface{})

Jump to

Keyboard shortcuts

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