mysql2

package
v0.0.0-...-4c9d98c Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// DSNDEFAULT utf-8
	DSNDEFAULT = "%s:%s@tcp(%s)/%s?charset=utf8&parseTime=True&loc=Local"

	// DSNUTF8MB4 utf-8 mb4
	DSNUTF8MB4 = "%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=True&loc=Local"
)

DSN code

Variables

This section is empty.

Functions

func DeleteCallBack

func DeleteCallBack(db *gorm.DB)

DeleteCallBack DeleteCallBack

func New

func New(config Config, log *zap.SugaredLogger) (*gorm.DB, error)

New 创建数据库连接

Types

type Config

type Config struct {
	Host     string
	DB       string
	User     string
	Password string
	Log      bool

	MaxIdleConns int
	MaxOpenConns int
	// contains filtered or unexported fields
}

Config 配置

func (*Config) SetDSN

func (c *Config) SetDSN(dsn string)

SetDSN SetDSN

func (*Config) String

func (c *Config) String() string

String String

Jump to

Keyboard shortcuts

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