golang sqlx wrap logger
go get github.com/nilorg/sqlxplus
import "github.com/nilorg/sqlxplus"
import (
"github.com/jmoiron/sqlx"
"github.com/nilorg/sqlxplus"
)
func main() {
driverName := "mysql"
dataSourceName := "xxx"
xdb, err := sqlx.Connect(driverName, dataSourceName)
if err != nil {
log.Fatalln(err)
}
xdbpuls := &sqlxplus.DB{SqlxTx: xdb, Log: &StdLogger{}}
var result map[string]interface{}
err = sqlx.GetContext(ctx, xdbpuls.DB(), &result, "select * from user where id = ?", 1)
if err != nil {
log.Fatalln(err)
}
}