Versions in this module Expand all Collapse all v0 v0.2.33 Apr 25, 2024 Changes in this version + func InjectCreatePool(fun CreateConnectFunc) + func TransSql(sql string, whereParams ...interface{}) string + type Aliaser interface + Count func() int64 + Find func() lib.SqlRow + Get func() lib.SqlRows + GroupBy func(field ...string) GroupByer + Join func(tableName string) Joiner + LeftJoin func(tableName string) Joiner + Limit func(offset, count int) Limiter + OrderBy func(orderBy string) OrderByer + Pager func(page, pageSize int) (lib.SqlRows, lib.SqlRow) + RightJoin func(tableName string) Joiner + Union func(model Modeler) Unioner + Update func(data lib.SqlIn) int64 + Where func(field string, value interface{}) Wherer + WhereIn func(field string, value interface{}) Wherer + WhereNotIn func(field string, value interface{}) Wherer + WhereRaw func(where string) Wherer + WhereSymbol func(field, symbol string, value interface{}) Wherer + type CreateConnectFunc func(*DB) []MsSqlConnect + type DB struct + func Connect(connectName, databaseName string) *DB + func GetDB() *DB + func NewDB() *DB + func (db *DB) BeginTransaction() + func (db *DB) Commit() + func (db *DB) Desc(tableName string) lib.Columns + func (db *DB) Exec(sql string) int64 + func (db *DB) IsExist(tableName string) bool + func (db *DB) Query(sql string, whereParams ...interface{}) lib.SqlRows + func (db *DB) Rollback() + func (db *DB) SetDB(connectName, databaseName string) DBer + func (db *DB) SetPool(pool MsSqlPooler) DBPool + func (db *DB) ShowDatabases() []string + func (db *DB) ShowTables() []string + type DBConfig struct + Charset string + DatabaseName string + Host string + MaxIdleConns int + MaxLifetime int + MaxOpenConns int + Name string + Password string + Port string + Prefix string + Suffix string + UserName string + type DBPool interface + SetDB func(connectName, databaseName string) DBer + type DBer interface + BeginTransaction func() + Commit func() + Desc func(tableName string) lib.Columns + Exec func(sql string) int64 + IsExist func(tableName string) bool + Query func(sql string, whereParams ...interface{}) lib.SqlRows + Rollback func() + ShowDatabases func() []string + ShowTables func() []string + type Fielder interface + Alias func(name string) Aliaser + Count func() int64 + Find func() lib.SqlRow + Get func() lib.SqlRows + GroupBy func(field ...string) GroupByer + Join func(tableName string) Joiner + LeftJoin func(tableName string) Joiner + Limit func(offset, count int) Limiter + OrderBy func(orderBy string) OrderByer + Pager func(page, pageSize int) (lib.SqlRows, lib.SqlRow) + RightJoin func(tableName string) Joiner + Union func(model Modeler) Unioner + Where func(field string, value interface{}) Wherer + WhereIn func(field string, value interface{}) Wherer + WhereNotIn func(field string, value interface{}) Wherer + WhereRaw func(where string) Wherer + WhereSymbol func(field, symbol string, value interface{}) Wherer + type GroupByer interface + Count func() int64 + Find func() lib.SqlRow + Get func() lib.SqlRows + Having func(field string, value interface{}) Havinger + HavingIn func(field string, value interface{}) Havinger + HavingNotIn func(field string, value interface{}) Havinger + HavingRaw func(having string) Havinger + HavingSymbol func(field, symbol string, value interface{}) Havinger + Limit func(offset, count int) Limiter + OrderBy func(orderBy string) OrderByer + Pager func(page, pageSize int) (lib.SqlRows, lib.SqlRow) + Union func(model Modeler) Unioner + type Havinger interface + AndHaving func(field string, value interface{}) Havinger + AndHavingIn func(field string, value interface{}) Havinger + AndHavingNotIn func(field string, value interface{}) Havinger + AndHavingRaw func(having string) Havinger + AndHavingSymbol func(field, symbol string, value interface{}) Havinger + Count func() int64 + Find func() lib.SqlRow + Get func() lib.SqlRows + Limit func(offset, count int) Limiter + OrHaving func(field string, value interface{}) Havinger + OrHavingIn func(field string, value interface{}) Havinger + OrHavingNotIn func(field string, value interface{}) Havinger + OrHavingRaw func(having string) Havinger + OrHavingSymbol func(field, symbol string, value interface{}) Havinger + OrderBy func(orderBy string) OrderByer + Pager func(page, pageSize int) (lib.SqlRows, lib.SqlRow) + Union func(model Modeler) Unioner + type Joiner interface + On func(field string, value interface{}) Oner + OnIn func(field string, value interface{}) Oner + OnNotIn func(field string, value interface{}) Oner + OnRaw func(on string) Oner + OnSymbol func(field, symbol string, value interface{}) Oner + type Limit struct + type Limiter interface + Find func() lib.SqlRow + Get func() lib.SqlRows + type Model struct + DeleteName string + PriKey string + SoftDelete bool + func (m *Model) Alias(name string) Aliaser + func (m *Model) AndHaving(field string, value interface{}) Havinger + func (m *Model) AndHavingIn(field string, value interface{}) Havinger + func (m *Model) AndHavingNotIn(field string, value interface{}) Havinger + func (m *Model) AndHavingRaw(having string) Havinger + func (m *Model) AndHavingSymbol(field, symbol string, value interface{}) Havinger + func (m *Model) AndOn(field string, value interface{}) Oner + func (m *Model) AndOnIn(field string, value interface{}) Oner + func (m *Model) AndOnNotIn(field string, value interface{}) Oner + func (m *Model) AndOnRaw(on string) Oner + func (m *Model) AndOnSymbol(field, symbol string, value interface{}) Oner + func (m *Model) AndWhere(field string, value interface{}) Wherer + func (m *Model) AndWhereIn(field string, value interface{}) Wherer + func (m *Model) AndWhereNotIn(field string, value interface{}) Wherer + func (m *Model) AndWhereRaw(where string) Wherer + func (m *Model) AndWhereSymbol(field, symbol string, value interface{}) Wherer + func (m *Model) Count() int64 + func (m *Model) CountByClear(isClear bool) int64 + func (m *Model) Create(row lib.SqlIn) int64 + func (m *Model) DB() DBer + func (m *Model) Delete() int64 + func (m *Model) Drop() int64 + func (m *Model) Fields(fields ...string) Fielder + func (m *Model) Find() lib.SqlRow + func (m *Model) Get() lib.SqlRows + func (m *Model) GetByClear(isClear bool) lib.SqlRows + func (m *Model) GetLastSql() string + func (m *Model) GetModelSql() (string, []interface{}) + func (m *Model) GetSqlInfo() (string, []interface{}) + func (m *Model) GroupBy(field ...string) GroupByer + func (m *Model) Having(field string, value interface{}) Havinger + func (m *Model) HavingIn(field string, value interface{}) Havinger + func (m *Model) HavingNotIn(field string, value interface{}) Havinger + func (m *Model) HavingRaw(having string) Havinger + func (m *Model) HavingSymbol(field, symbol string, value interface{}) Havinger + func (m *Model) Init(dbName, tableName string) Modeler + func (m *Model) InitByConnectName(connectName, dbName, tableName string) Modeler + func (m *Model) Insert(row lib.SqlIn) int64 + func (m *Model) Join(tableName string) Joiner + func (m *Model) LeftJoin(tableName string) Joiner + func (m *Model) Limit(offset, count int) Limiter + func (m *Model) On(field string, value interface{}) Oner + func (m *Model) OnIn(field string, value interface{}) Oner + func (m *Model) OnNotIn(field string, value interface{}) Oner + func (m *Model) OnRaw(on string) Oner + func (m *Model) OnSymbol(field, symbol string, value interface{}) Oner + func (m *Model) OrHaving(field string, value interface{}) Havinger + func (m *Model) OrHavingIn(field string, value interface{}) Havinger + func (m *Model) OrHavingNotIn(field string, value interface{}) Havinger + func (m *Model) OrHavingRaw(having string) Havinger + func (m *Model) OrHavingSymbol(field, symbol string, value interface{}) Havinger + func (m *Model) OrOn(field string, value interface{}) Oner + func (m *Model) OrOnIn(field string, value interface{}) Oner + func (m *Model) OrOnNotIn(field string, value interface{}) Oner + func (m *Model) OrOnRaw(on string) Oner + func (m *Model) OrOnSymbol(field, symbol string, value interface{}) Oner + func (m *Model) OrWhere(field string, value interface{}) Wherer + func (m *Model) OrWhereIn(field string, value interface{}) Wherer + func (m *Model) OrWhereNotIn(field string, value interface{}) Wherer + func (m *Model) OrWhereRaw(where string) Wherer + func (m *Model) OrWhereSymbol(field, symbol string, value interface{}) Wherer + func (m *Model) OrderBy(orderBy string) OrderByer + func (m *Model) Pager(page, pageSize int) (lib.SqlRows, lib.SqlRow) + func (m *Model) RightJoin(tableName string) Joiner + func (m *Model) Truncate() int64 + func (m *Model) Union(model Modeler) Unioner + func (m *Model) Update(data lib.SqlIn) int64 + func (m *Model) Where(field string, value interface{}) Wherer + func (m *Model) WhereIn(field string, value interface{}) Wherer + func (m *Model) WhereNotIn(field string, value interface{}) Wherer + func (m *Model) WhereRaw(where string) Wherer + func (m *Model) WhereSymbol(field, symbol string, value interface{}) Wherer + type Modeler interface + Alias func(name string) Aliaser + Count func() int64 + Create func(row lib.SqlIn) int64 + DB func() DBer + Delete func() int64 + Drop func() int64 + Fields func(fields ...string) Fielder + Find func() lib.SqlRow + Get func() lib.SqlRows + GetLastSql func() string + GetModelSql func() (string, []interface{}) + GetSqlInfo func() (string, []interface{}) + GroupBy func(field ...string) GroupByer + Insert func(row lib.SqlIn) int64 + Join func(tableName string) Joiner + LeftJoin func(tableName string) Joiner + Limit func(offset, count int) Limiter + OrderBy func(orderBy string) OrderByer + Pager func(page, pageSize int) (lib.SqlRows, lib.SqlRow) + RightJoin func(tableName string) Joiner + Truncate func() int64 + Union func(model Modeler) Unioner + Update func(data lib.SqlIn) int64 + Where func(field string, value interface{}) Wherer + WhereIn func(field string, value interface{}) Wherer + WhereNotIn func(field string, value interface{}) Wherer + WhereRaw func(where string) Wherer + WhereSymbol func(field, symbol string, value interface{}) Wherer + func NewModel(dbName, tableName string) Modeler + func NewModelByConnectName(connectName, dbName, tableName string) Modeler + type MsSqlConnect struct + Master DBConfig + Slave []DBConfig + func (m MsSqlConnect) String() string + type MsSqlPool struct + func (m *MsSqlPool) AddConnect(connect MsSqlConnect) + func (m *MsSqlPool) AddConnects(connects []MsSqlConnect) + func (m *MsSqlPool) BeginTx(connectName string) + func (m *MsSqlPool) Close() + func (m *MsSqlPool) EndTx(connectName string) + func (m *MsSqlPool) GetDB(connectName string) *sql.DB + func (m *MsSqlPool) GetIncludeReadDB(connectName string) *sql.DB + func (m *MsSqlPool) GetTx(connectName string) *sql.Tx + func (m *MsSqlPool) Init(connects []MsSqlConnect) + func (m *MsSqlPool) IsTransaction(connectName string) bool + func (m *MsSqlPool) SetTx(connectName string, tx *sql.Tx) + type MsSqlPooler interface + AddConnect func(connect MsSqlConnect) + AddConnects func(connects []MsSqlConnect) + BeginTx func(connectName string) + Close func() + EndTx func(connectName string) + GetDB func(connectName string) *sql.DB + GetIncludeReadDB func(connectName string) *sql.DB + GetTx func(connectName string) *sql.Tx + Init func(connect []MsSqlConnect) + IsTransaction func(connectName string) bool + SetTx func(connectName string, tx *sql.Tx) + func NewPool(config MsSqlConnect) MsSqlPooler + func NewPools(configs []MsSqlConnect) MsSqlPooler + type Oner interface + AndOn func(field string, value interface{}) Oner + AndOnIn func(field string, value interface{}) Oner + AndOnNotIn func(field string, value interface{}) Oner + AndOnRaw func(on string) Oner + AndOnSymbol func(field, symbol string, value interface{}) Oner + Count func() int64 + Find func() lib.SqlRow + Get func() lib.SqlRows + GroupBy func(field ...string) GroupByer + Join func(tableName string) Joiner + LeftJoin func(tableName string) Joiner + Limit func(offset, count int) Limiter + OrOn func(field string, value interface{}) Oner + OrOnIn func(field string, value interface{}) Oner + OrOnNotIn func(field string, value interface{}) Oner + OrOnRaw func(on string) Oner + OrOnSymbol func(field, symbol string, value interface{}) Oner + OrderBy func(orderBy string) OrderByer + Pager func(page, pageSize int) (lib.SqlRows, lib.SqlRow) + RightJoin func(tableName string) Joiner + Union func(model Modeler) Unioner + Update func(data lib.SqlIn) int64 + Where func(field string, value interface{}) Wherer + WhereIn func(field string, value interface{}) Wherer + WhereNotIn func(field string, value interface{}) Wherer + WhereRaw func(where string) Wherer + WhereSymbol func(field, symbol string, value interface{}) Wherer + type OrderByer interface + Find func() lib.SqlRow + Get func() lib.SqlRows + Limit func(offset, count int) Limiter + Pager func(page, pageSize int) (lib.SqlRows, lib.SqlRow) + type Table struct + func (t *Table) Delete(onParams []interface{}, where string, whereParams ...interface{}) int64 + func (t *Table) Drop() int64 + func (t *Table) GetDB() *DB + func (t *Table) GetLastSql() string + func (t *Table) GetSqlInfo() (string, []interface{}) + func (t *Table) Insert(row lib.SqlIn) int64 + func (t *Table) Select(fields string, where string, whereParams ...interface{}) lib.SqlRows + func (t *Table) SelectByHasWhere(fields string, where string, hasWhere bool, page *Limit, ...) lib.SqlRows + func (t *Table) SetDB(db *DB) + func (t *Table) Truncate() int64 + func (t *Table) Update(row lib.SqlIn, onParams []interface{}, where string, ...) int64 + type Tabler interface + Delete func(onParams []interface{}, where string, whereParams ...interface{}) int64 + Drop func() int64 + GetDB func() *DB + GetLastSql func() string + GetSqlInfo func() (string, []interface{}) + Insert func(row lib.SqlIn) int64 + Select func(fields string, where string, whereParams ...interface{}) lib.SqlRows + SelectByHasWhere func(fields string, where string, hasWhere bool, page *Limit, ...) lib.SqlRows + SetDB func(db *DB) + Truncate func() int64 + Update func(row lib.SqlIn, onParams []interface{}, where string, ...) int64 + func NewTable(db *DB, tableName, firstTableName, pri string) Tabler + type Unioner interface + Count func() int64 + Find func() lib.SqlRow + Get func() lib.SqlRows + Limit func(offset, count int) Limiter + OrderBy func(orderBy string) OrderByer + Pager func(page, pageSize int) (lib.SqlRows, lib.SqlRow) + type Wherer interface + AndWhere func(field string, value interface{}) Wherer + AndWhereIn func(field string, value interface{}) Wherer + AndWhereNotIn func(field string, value interface{}) Wherer + AndWhereRaw func(where string) Wherer + AndWhereSymbol func(field, symbol string, value interface{}) Wherer + Count func() int64 + Delete func() int64 + Find func() lib.SqlRow + Get func() lib.SqlRows + GroupBy func(field ...string) GroupByer + Limit func(offset, count int) Limiter + OrWhere func(field string, value interface{}) Wherer + OrWhereIn func(field string, value interface{}) Wherer + OrWhereNotIn func(field string, value interface{}) Wherer + OrWhereRaw func(where string) Wherer + OrWhereSymbol func(field, symbol string, value interface{}) Wherer + OrderBy func(orderBy string) OrderByer + Pager func(page, pageSize int) (lib.SqlRows, lib.SqlRow) + Union func(model Modeler) Unioner + Update func(data lib.SqlIn) int64