orm

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoRow          = sql.ErrNoRows
	ErrRecordNotFound = gorm.ErrRecordNotFound

	LogLevelMap = map[string]logger.LogLevel{
		"info":   logger.Info,
		"warn":   logger.Warn,
		"error":  logger.Error,
		"silent": logger.Silent,
	}
)

Functions

func InitGormV2

func InitGormV2(c *MySQLConfig) (db *gorm.DB)

Types

type MySQLConfig

type MySQLConfig struct {
	DSN            string         // data source name.
	MaxOpenConn    int            // pool, e.g:10
	MaxIdleConn    int            // pool, e.g:100
	MaxConnTimeout xtime.Duration // connect max life time. Unmarshal config file e.g: 10s、2m、1m10s
	LogLevel       string         // enum: info、warn、error、silent, default warn
	Colorful       bool           // is colorful log, default false
	SlowThreshold  xtime.Duration // slow sql log. Unmarshal config file e.g: 100ms、200ms、300ms、1s, default 200ms
}

MySQLConfig mysql config.

type Page added in v1.0.6

type Page struct {
	PageNo   int `json:"page_no"`
	PageSize int `json:"page_size"`
}

func (*Page) Apply added in v1.0.6

func (p *Page) Apply(db *gorm.DB)

Jump to

Keyboard shortcuts

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