db

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dsn

func Dsn(dsn string) func(*dbCfg)

Dsn set dbCfg conn addr

func GetConn

func GetConn(ctx context.Context) (*sql.Conn, error)

GetConn from db conn pool

func NewDb

func NewDb(opts ...Option) (err error)

NewDb create new db

Types

type Option

type Option func(*dbCfg)

Option is function option

func Drivename

func Drivename(drivename string) Option

Drivename Set mysql or sqlite

func MaxIdleConnection

func MaxIdleConnection(idle int) Option

MaxIdleConnection set sql db max idle conn

func MaxOpenConnection

func MaxOpenConnection(open int) Option

MaxOpenConnection set sql db max open conn

func MaxQueryTime

func MaxQueryTime(query time.Duration) Option

MaxQueryTime set sql conn exec max timeout

Jump to

Keyboard shortcuts

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