Documentation ¶
Index ¶
- func BuildDataSourceString(opts Options) string
- func DeleteMany(tx AbstractDBBase, query string, args ...interface{}) (rowsAffected int64, success bool)
- func DeleteOne(tx AbstractDBBase, query string, args ...interface{}) (rowsAffected int64, success bool)
- func DisableDebug()
- func EnableDebug()
- func FindCount(tx AbstractDBBase, query string, args ...interface{}) (count int64, success bool)
- func FindMany(tx AbstractDBBase, dest interface{}, query string, args ...interface{}) (success bool)
- func FindOne(tx AbstractDBBase, dest interface{}, query string, args ...interface{}) (success bool)
- func InsertMany(tx AbstractDBBase, query string, args ...interface{}) (lastInsertId int64, success bool)
- func InsertOne(tx AbstractDBBase, query string, args ...interface{}) (insertId int64, success bool)
- func MustOpen(driverName string, dataSourceName string) *sqlx.DB
- func MustOpenWithOptions(driverName string, opts Options) *sqlx.DB
- func Open(driverName string, dataSourceName string) (*sqlx.DB, error)
- func OpenWithOptions(driverName string, opts Options) (*sqlx.DB, error)
- func UpdateMany(tx AbstractDBBase, query string, args ...interface{}) (rowsAffected int64, success bool)
- func UpdateOne(tx AbstractDBBase, query string, args ...interface{}) (rowsAffected int64, success bool)
- type AbstractDB
- type AbstractDBBase
- type AbstractTx
- type DB
- type Options
- type QueryCountRow
- type Row
- type Tx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteMany ¶
func DeleteMany(tx AbstractDBBase, query string, args ...interface{}) (rowsAffected int64, success bool)
删除多条数据
func DeleteOne ¶
func DeleteOne(tx AbstractDBBase, query string, args ...interface{}) (rowsAffected int64, success bool)
删除一条数据
func DisableDebug ¶
func DisableDebug()
func EnableDebug ¶
func EnableDebug()
func FindCount ¶
func FindCount(tx AbstractDBBase, query string, args ...interface{}) (count int64, success bool)
查询记录数量,需要 SELECT count(*) AS count FROM ... 这样的格式
func FindMany ¶
func FindMany(tx AbstractDBBase, dest interface{}, query string, args ...interface{}) (success bool)
查询多条数据
func FindOne ¶
func FindOne(tx AbstractDBBase, dest interface{}, query string, args ...interface{}) (success bool)
查询一条数据
func InsertMany ¶
func InsertMany(tx AbstractDBBase, query string, args ...interface{}) (lastInsertId int64, success bool)
插入多条记录
func InsertOne ¶
func InsertOne(tx AbstractDBBase, query string, args ...interface{}) (insertId int64, success bool)
插入一条数据
func MustOpenWithOptions ¶
创建数据库连接,如果失败则panic
func OpenWithOptions ¶
创建数据库连接
func UpdateMany ¶
func UpdateMany(tx AbstractDBBase, query string, args ...interface{}) (rowsAffected int64, success bool)
更新多条数据
Types ¶
type AbstractDB ¶
type AbstractDB interface { AbstractDBBase MustBegin() AbstractTx }
type AbstractDBBase ¶
type AbstractTx ¶
type AbstractTx interface { AbstractDBBase Rollback() error Commit() error }
type QueryCountRow ¶
type QueryCountRow struct {
Count int64 `db:"count"`
}
Click to show internal directories.
Click to hide internal directories.