Documentation ¶
Index ¶
- type DB
- func (db *DB) Begin() *Tx
- func (db *DB) Delete(table string, wheres string, args ...interface{}) (int64, error)
- func (db *DB) Exec(requestSql string, args ...interface{}) (int64, error)
- func (db *DB) Insert(table string, data map[string]interface{}) (int64, error)
- func (db *DB) Query(requestSql string, args ...interface{}) ([]map[string]interface{}, error)
- func (db *DB) Replace(table string, data map[string]interface{}) (int64, error)
- func (db *DB) Update(table string, data map[string]interface{}, wheres string, args ...interface{}) (int64, error)
- type Tx
- func (tx *Tx) CheckFinished() error
- func (tx *Tx) Commit() error
- func (tx *Tx) Delete(table string, wheres string, args ...interface{}) (int64, error)
- func (tx *Tx) Exec(requestSql string, args ...interface{}) (int64, error)
- func (tx *Tx) Finish(ok bool) error
- func (tx *Tx) Insert(table string, data map[string]interface{}) (int64, error)
- func (tx *Tx) Query(requestSql string, args ...interface{}) ([]map[string]interface{}, error)
- func (tx *Tx) Replace(table string, data map[string]interface{}) (int64, error)
- func (tx *Tx) Rollback() error
- func (tx *Tx) Update(table string, data map[string]interface{}, wheres string, args ...interface{}) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func GetDB ¶
GetDB 获得数据库连接 GetDB name 连接配置名称,如果不提供名称则使用默认连接 GetDB return 数据库连接,对象内置连接池操作,完成后无需手动关闭连接
func (*DB) Exec ¶
Exec 执行SQL * requestSql SQL语句 * args SQL语句中问号变量的值,按顺序放在请求参数中 Exec return 如果是INSERT到含有自增字段的表中返回插入的自增ID,否则返回影响的行数
func (*DB) Insert ¶
Insert 插入数据 * table 表名 * data 数据对象(Key-Value格式) Insert return 如果是INSERT到含有自增字段的表中返回插入的自增ID,否则返回影响的行数
Click to show internal directories.
Click to hide internal directories.