Documentation
¶
Index ¶
- func InitSQL(filePath string) (result map[string]string, err error)
- func IsEmpty(contrast string, call func(isEmpty bool))
- type DB
- func (db *DB) AutoRefreshSQL()
- func (db *DB) AutoRefreshSQLCustom(spec string)
- func (db *DB) Begin() (*TxDB, error)
- func (db *DB) BeginWithIsol(isolLevel sql.IsolationLevel, readOnly bool) (*TxDB, error)
- func (db *DB) Close()
- func (db *DB) Delete(query string, args ...interface{}) (int64, error)
- func (db *DB) Exec(name string, param ...interface{}) (sql.Result, error)
- func (db *DB) GetRow(name string, param ...interface{}) (map[string]interface{}, error)
- func (db *DB) GetRows(name string, param ...interface{}) ([]map[string]interface{}, error)
- func (db *DB) GetVal(name string, param ...interface{}) (interface{}, error)
- func (db *DB) Insert(query string, args ...interface{}) (int64, error)
- func (db *DB) InsertMany(tableName string, params []map[string]interface{})
- func (db *DB) RefreshSQL()
- func (db *DB) SetConnMaxLifetime(d time.Duration)
- func (db *DB) SetDeBUG(b bool)
- func (db *DB) SetMaxIdleConn(n int)
- func (db *DB) SetMaxOpenConn(n int)
- func (db *DB) SetSQLPath(filePath string)
- func (db *DB) Update(query string, args ...interface{}) (int64, error)
- type TxDB
- func (txConn *TxDB) Commit() error
- func (txConn *TxDB) Delete(query string, args ...interface{}) (int64, error)
- func (txConn *TxDB) GetRow(query string, args ...interface{}) (map[string]interface{}, error)
- func (txConn *TxDB) GetRows(query string, args ...interface{}) ([]map[string]interface{}, error)
- func (txConn *TxDB) GetVal(query string, args ...interface{}) (interface{}, error)
- func (txConn *TxDB) Insert(query string, args ...interface{}) (int64, error)
- func (txConn *TxDB) Rollback() error
- func (txConn *TxDB) Update(query string, args ...interface{}) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func Open ¶
func Open(driverName string, username string, password string, ip string, port string, dbName string) (*DB, error)
Open 初始化创建连接
func (*DB) AutoRefreshSQL ¶ added in v0.0.3
func (db *DB) AutoRefreshSQL()
AutoRefreshSQL 自动刷新SQL-无需重启服务 不建议生产环境启用 默认值5S一次
func (*DB) AutoRefreshSQLCustom ¶ added in v0.0.3
AutoRefreshSQL 自动刷新SQL-无需重启服务 不建议生产环境启用
func (*DB) BeginWithIsol ¶
BeginWithIsol transaction begin with custom isolation level is dependent LevelDefault 默认级别 LevelReadUncommitted 读未提交 LevelReadCommitted 读已提交 LevelWriteCommitted 写已提交 LevelRepeatableRead 可重复读 LevelSnapshot 可读快照 LevelSerializable 可串行化 LevelLinearizable 可线性化
func (*DB) InsertMany ¶ added in v0.0.3
func (*DB) SetConnMaxLifetime ¶
SetConnMaxLifetime 设置连接的最大可复用时间。
func (*DB) SetSQLPath ¶ added in v0.0.3
SetSQLPath 设置md的sql文件访问路径
type TxDB ¶
type TxDB struct {
// contains filtered or unexported fields
}
TxDB tx obj
Click to show internal directories.
Click to hide internal directories.