gorm_db

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 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           = "http://localhost:8123/test?username=default&password=123456&dial_timeout=200ms&max_execution_time=60"
	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