Documentation ¶
Overview ¶
dbmgr.go
option.go
util.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Rows2Map ¶
Rows2Map convers rows to []map[string]interface{} caller call the function rows.Close()
func Sql2Map ¶
Sql2Map convers query to []map[string]interface{}
That's a specialty of MySQL: you have to use prepared statements to get the native types. MySQL has two protocols, one transmits everything as text, the other as the "real" type. And that binary protocol is only used when you use prepared statements. The driver is pretty much powerless to enforce a protocol and the text protocol takes less resources on the server.
This may help you:
stmt, err := db.Prepare(sqlString) if err != nil { ...... } defer stmt.Close() rows, err := stmt.Query()
Types ¶
type DBOptionFn ¶
type DBOptionFn func(*DB)
func WithConnMaxIdleTime ¶
func WithConnMaxIdleTime(d time.Duration) DBOptionFn
func WithConnMaxLifetime ¶
func WithConnMaxLifetime(d time.Duration) DBOptionFn
func WithMaxIdleConns ¶
func WithMaxIdleConns(n int) DBOptionFn
func WithMaxOpenConns ¶
func WithMaxOpenConns(n int) DBOptionFn