mysql

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Unlicense Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Scan

func Scan(rs *sql.Rows) ([]map[string]interface{}, error)

Resolve 将 SQL 查询结构 序列化到一个 map 中

Types

type DB

type DB struct {
	*gorm.DB
	// contains filtered or unexported fields
}

func NewDB

func NewDB(ops Options) (*DB, error)

func (*DB) Close

func (f *DB) Close() error

Close 关闭数据库连接

type Options

type Options struct {
	Driver  string `yaml:"driver" mapstructure:"driver"`
	ConnStr string `yaml:"dsn" mapstructure:"dsn"`
	// 定时保活
	KeepAlive int `yaml:"keep_alive" mapstructure:"keep_alive"`
	// 最大可空闲连接数量
	MaxIdles int `yaml:"max_idles" mapstructure:"max_idles"`
	// 最大连接数量
	MaxOpens    int  `yaml:"max_opens" mapstructure:"max_opens"`
	MaxLifeTime int  `yaml:"max_life_time" mapstructure:"max_life_time"`
	LogMode     bool `yaml:"log_mode" mapstructure:"log_mode"`
}

Jump to

Keyboard shortcuts

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