Documentation ¶
Index ¶
- Constants
- func NewMysqlConn(c *v1config.DBConfig, fs ...func(config *mysql.Config)) (*sql.DB, error)
- type DBMysql
- func (d *DBMysql) BeginTrans() (IDBMysql, error)
- func (d *DBMysql) CommitTrans() error
- func (d *DBMysql) DB() *sql.DB
- func (d *DBMysql) ExecuteCreate(tableName string, fields map[string]interface{}) (int64, error)
- func (d *DBMysql) ExecuteQuery(tableName string, fields map[string]interface{}, whereArr []string, ...) (bool, error)
- func (d *DBMysql) ExecuteSearch(tableName string, fields []string, whereArr []string, whereArgs []interface{}, ...) (int64, int64, error)
- func (d *DBMysql) ExecuteUpdate(tableName string, fields map[string]interface{}, whereArr []string, ...) (int64, error)
- func (d *DBMysql) RollbackTrans() error
- func (d *DBMysql) TX() *sql.Tx
- func (d *DBMysql) WithDB(db *sql.DB) *DBMysql
- type GormMysql
- func (d *GormMysql) BeginTrans() (IGormMysql, error)
- func (d *GormMysql) CommitTrans() error
- func (d *GormMysql) DB() *sql.DB
- func (d *GormMysql) ExecuteCreate(tableName string, fields map[string]interface{}) (int64, error)
- func (d *GormMysql) ExecuteQuery(tableName string, fields map[string]interface{}, whereArr []string, ...) (bool, error)
- func (d *GormMysql) ExecuteSearch(tableName string, fields []string, whereArr []string, whereArgs []interface{}, ...) (int64, int64, error)
- func (d *GormMysql) ExecuteUpdate(tableName string, fields map[string]interface{}, whereArr []string, ...) (int64, error)
- func (d *GormMysql) GormDB() *gorm.DB
- func (d *GormMysql) GormTX() gorm.ConnPool
- func (d *GormMysql) RollbackTrans() error
- func (d *GormMysql) WithDB(db *gorm.DB) *GormMysql
- type IDBMysql
- type IGormMysql
- type SearchRowsHandler
Constants ¶
View Source
const MaxConcatLen = "18446744073709551615"
View Source
const MaxIdleConns = 80
View Source
const MaxIdleTime = 30 * time.Minute
View Source
const MaxLifeTime = 30 * time.Minute
View Source
const MaxOpenConns = 256
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DBMysql ¶
func NewDBMysql ¶
func (*DBMysql) BeginTrans ¶
func (*DBMysql) CommitTrans ¶
func (*DBMysql) ExecuteCreate ¶
func (*DBMysql) ExecuteQuery ¶
func (*DBMysql) ExecuteSearch ¶
func (*DBMysql) ExecuteUpdate ¶
func (*DBMysql) RollbackTrans ¶
type GormMysql ¶
type GormMysql struct { //db,正常操作db,开始事务后为begin后的gorm Edb *gorm.DB //tx,初始为nil,开始事务后为对应事务上下文 //可判断是否为nil来判断是否开始了事务 Etx gorm.ConnPool }
func NewGormMysql ¶
NewGormMysql gorm的mysql操作db
func (*GormMysql) BeginTrans ¶
func (d *GormMysql) BeginTrans() (IGormMysql, error)
func (*GormMysql) CommitTrans ¶
func (*GormMysql) ExecuteCreate ¶
func (*GormMysql) ExecuteQuery ¶
func (*GormMysql) ExecuteSearch ¶
func (*GormMysql) ExecuteUpdate ¶
func (*GormMysql) RollbackTrans ¶
type IDBMysql ¶
type IDBMysql interface { DB() *sql.DB TX() *sql.Tx ExecuteSearch(tableName string, fields []string, whereArr []string, whereArgs []interface{}, orderBy []string, pageNum, pageSize int64, rowsHandler SearchRowsHandler) (int64, int64, error) ExecuteQuery(tableName string, fields map[string]interface{}, whereArr []string, whereArgs []interface{}, orderBy []string) (bool, error) ExecuteCreate(tableName string, fields map[string]interface{}) (int64, error) ExecuteUpdate(tableName string, fields map[string]interface{}, whereArr []string, whereArgs []interface{}) (int64, error) BeginTrans() (IDBMysql, error) CommitTrans() error RollbackTrans() error }
type IGormMysql ¶
type IGormMysql interface { DB() *sql.DB GormDB() *gorm.DB GormTX() gorm.ConnPool ExecuteSearch(tableName string, fields []string, whereArr []string, whereArgs []interface{}, orderBy []string, pageNum, pageSize int64, rowsHandler SearchRowsHandler) (int64, int64, error) ExecuteQuery(tableName string, fields map[string]interface{}, whereArr []string, whereArgs []interface{}, orderBy []string) (bool, error) ExecuteCreate(tableName string, fields map[string]interface{}) (int64, error) ExecuteUpdate(tableName string, fields map[string]interface{}, whereArr []string, whereArgs []interface{}) (int64, error) BeginTrans() (IGormMysql, error) CommitTrans() error RollbackTrans() error }
type SearchRowsHandler ¶
Click to show internal directories.
Click to hide internal directories.