vegedsn

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultParams = map[string]string{
	"charset":   "utf8mb4",
	"parseTime": "True",
	"loc":       "Local",
}

Functions

This section is empty.

Types

type DefaultDns

type DefaultDns struct {
	Username string
	Password string
	Address  string
	Database string
}

给NewDefaultMysqlDsn调用者提供一个默认的dsn struct,便于conf读取

type MysqlDSN

type MysqlDSN struct {
	Dsn      string
	Type     string //Deprecated
	Username string
	Password string
	Protocol string
	Address  string
	Database string
	Params   map[string]string
}

func NewDefaultMysqlDsn

func NewDefaultMysqlDsn(params map[string]string, ops ...MysqlDsnOptionFunc) *MysqlDSN

func ParseMysqlDSN

func ParseMysqlDSN(s string) *MysqlDSN

Turns a MysqlDSN string into a parsed MysqlDSN struct.

func (*MysqlDSN) String

func (d *MysqlDSN) String() string

Converts a MysqlDSN struct into its string representation.

type MysqlDsnOptionFunc

type MysqlDsnOptionFunc func(dsn *MysqlDSN)

func WithAddress

func WithAddress(addr string) MysqlDsnOptionFunc

func WithAuth

func WithAuth(u string, pswd string) MysqlDsnOptionFunc

func WithDatabase

func WithDatabase(dbname string) MysqlDsnOptionFunc

Directories

Path Synopsis
gen

Jump to

Keyboard shortcuts

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