Versions in this module Expand all Collapse all v0 v0.4.0 Mar 11, 2019 Changes in this version + const DBErrCodeAuthorized + const DBErrCodeException + const DBErrCodeExists + const DBErrCodeNotConnect + const DBErrCodeNotFound + const DBErrCodeOK + func ErrSQLNoRows(err error) bool + func ReleaseConfigDB(dbx *DB) + func ReleaseDB() + func ReplyToReplyData(reply Reply) *tyr.ReplyData + func SetDbConfig(cfg Config) + type Config struct + DNS string + Driver string + MaxIdle int + MaxLifetime time.Duration + MaxOpenConns int + type DB struct + func NewConfigDB(config Config) (dbx *DB, err error) + func NewDB() *DB + func (d *DB) BeginTrans() (err error) + func (d *DB) Close() + func (d *DB) Commit() error + func (d *DB) Connect() (err error) + func (d *DB) Insert(query string, args interface{}) (LastInsertId, RowsAffected int64, err error) + func (d *DB) InsertReply(query string, args interface{}) (reply Reply) + func (d *DB) Limit(page, pagesize int) string + func (d *DB) Rollback() error + func (d *DB) Row(dest interface{}, query string, args interface{}) error + func (d *DB) Rows(dest interface{}, query string, args interface{}) error + func (d *DB) TransExec(query string, args interface{}) (LastInsertId, RowsAffected int64, err error) + func (d *DB) TransUpdate(query string, args interface{}) (reply Reply) + func (d *DB) Update(query string, args interface{}) (RowsAffected int64, err error) + func (d *DB) UpdateReply(query string, args interface{}) (reply Reply) + type Reply struct + Err error + ErrCode int + LastErr error + LastID int64 + OK bool + RowsAffected int64 + func ReplyFaild(errCode int, err, errText error) (reply Reply) + func ReplyOk(rowsAffected, lastID int64) Reply