gorm_db

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	SilentLogLevel = "silent"
	ErrorLogLevel  = "error"
	WarnLogLevel   = "warn"
	InfoLogLevel   = "info"
)
View Source
const (
	DefaultLogLevel        = gormLogger.Warn
	DefaultMysqlDSN        = "root:123456@tcp(localhost:3306)/demo?charset=utf8mb4&parseTime=True&loc=Local"
	DefaultCkDSN           = "tcp://localhost:9000?database=demo&username=root&password=123456&read_timeout=10&write_timeout=20"
	DefaultPGDSN           = "host=localhost user=root password=123456 dbname=demo port=9920 sslmode=disable TimeZone=Asia/Shanghai"
	DefaultMaxOpenConn     = 1000
	DefaultMaxIdleConn     = 100
	DefaultConnMaxLifetime = 3600
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GormDB

type GormDB struct {
	DB *gorm.DB
}

func (*GormDB) InitCK

func (g *GormDB) InitCK(options ...Option) error

func (*GormDB) InitMysql

func (g *GormDB) InitMysql(options ...Option) error

func (*GormDB) InitPG

func (g *GormDB) InitPG(options ...Option) error

type Option

type Option func(*Options)

func ConnMaxLifetime

func ConnMaxLifetime(connMaxLifetime int) Option

func DSN

func DSN(dsn string) Option

func LogLevel

func LogLevel(logLevel string) Option

func MaxIdleConn

func MaxIdleConn(maxIdleConn int) Option

func MaxOpenConn

func MaxOpenConn(maxOpenConn int) Option

type Options

type Options struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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