Documentation ¶
Index ¶
- Constants
- func ErrSQLNoRows(err error) bool
- func ReleaseConfigDB(dbx *DB)
- func ReleaseDB()
- func ReplyToReplyData(reply Reply) *tyr.ReplyData
- func SetDbConfig(cfg Config)
- type Config
- type 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
Constants ¶
View Source
const ( DBErrCodeOK = 0 // DBErrCodeOK ok DBErrCodeException = 1 // DBErrCodeException exception DBErrCodeExists = 2 // DBErrCodeExists exists DBErrCodeNotFound = 3 // DBErrCodeNotFound not found DBErrCodeAuthorized = 4 // DBErrCodeAuthorized authorized DBErrCodeNotConnect = 5 // DBErrCodeNotConnect connect error )
DB error code
Variables ¶
This section is empty.
Functions ¶
func ReplyToReplyData ¶
ReplyToReplyData db reply to response
Types ¶
type Config ¶
type Config struct { Driver string DNS string MaxOpenConns int MaxIdle int MaxLifetime time.Duration }
Config config
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB define
func NewConfigDB ¶
NewConfigDB new DB dynamic object
func (*DB) InsertReply ¶
InsertReply insert and return DbReply
func (*DB) TransExec ¶
func (d *DB) TransExec(query string, args interface{}) (LastInsertId, RowsAffected int64, err error)
TransExec trans execute
func (*DB) TransUpdate ¶
TransUpdate trans update
func (*DB) UpdateReply ¶
UpdateReply update/delete and return DbReply
Click to show internal directories.
Click to hide internal directories.