mysql

package
v0.0.0-...-1569ab3 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

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

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

Variables

This section is empty.

Functions

func New

func New(config *MysqlConfig, log pkglogger.AdaptedLogger) (*gorm.DB, error)

New return a gorm db

Types

type MysqlConfig

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

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

Config mysql config

func (*MysqlConfig) SetDSN

func (c *MysqlConfig) SetDSN(dsn string)

SetDSN set dsn

func (*MysqlConfig) String

func (c *MysqlConfig) String() string

String return dsn string

Jump to

Keyboard shortcuts

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