Versions in this module Expand all Collapse all v1 v1.0.1 May 30, 2022 v1.0.0 May 31, 2022 Changes in this version + var LogFormatter = func(values ...interface{}) (messages []interface{}) + var NowFunc = func() time.Time + func CheckDbExists(key string) bool + func CheckPassword(hashKey string, password string) bool + func CreateTable(models ...interface{}) + func CreateTableWithKey(dbName string, models ...interface{}) + func Encrypt(text string, key string) (string, error) + func GenerateUpdateSQL(st *gorm.ModelStruct, tableName string, rows interface{}, cols []string, ...) (string, []interface{}, bool) + func HashPassword(password string) string + func Init(conf *DbSettings) error + func InitDBWithDbName(conf *DbSettings, dbName string) error + func RemoveDbByKey(key string) + func SetTablePrefix(prefix string) + func Validate(value interface{}, vtype string, isZero bool) error + type Checker struct + func (c *Checker) Check() (bool, map[string]string, string) + func (c *Checker) Enabled() bool + func (c *Checker) GetName() string + type DBLogWriter struct + func (t *DBLogWriter) Println(v ...interface{}) + func (t *DBLogWriter) SetProperty(key, val string) + type DbSettings struct + ConnMaxLifetime int + DbName string + Dialect string + Host string + Key string + MaxIdleConns int + MaxOpenConns int + Password string + Port int + User string + type FiDB struct + Error error + RowsAffected int64 + func NewDB(ctx xcontext.XContext) *FiDB + func NewNamedDB(dbName string, ctx xcontext.XContext) *FiDB + func NewQuery() *FiDB + func NewQueryWithDbName(dbName string) *FiDB + func (db *FiDB) GetLogWriter() *DBLogWriter + func (db *FiDB) WithLogFields(fields map[string]string) *FiDB + func (db *FiDB) WithLogTraceID(traceID string) *FiDB + func (t *FiDB) BatchInsert(entities interface{}) error + func (t *FiDB) BatchUpdate(entities interface{}, cols []string) error + func (t *FiDB) Count(value interface{}) *FiDB + func (t *FiDB) Create(entityPtr interface{}) error + func (t *FiDB) Delete(row interface{}, where ...interface{}) error + func (t *FiDB) DeleteItem(entityPtrOrSlice interface{}) error + func (t *FiDB) DeleteItemsByID(entities interface{}) error + func (t *FiDB) DynamicBatchInsert(tableName string, entities interface{}) error + func (t *FiDB) DynamicBatchUpdate(tableName string, entities interface{}, cols []string) error + func (t *FiDB) Exec(sql string, values ...interface{}) error + func (t *FiDB) ExecuteTextQuery(entitiesPrt interface{}, sql string, values ...interface{}) error + func (t *FiDB) Find(entitiesPrt interface{}, where ...interface{}) *FiDB + func (t *FiDB) First(entityPrt interface{}, where ...interface{}) *FiDB + func (t *FiDB) ForUpdate() *FiDB + func (t *FiDB) GetItemWhere(entitiesPrt interface{}, query interface{}, args ...interface{}) error + func (t *FiDB) GetItemWhereFirst(entityPrt interface{}, query interface{}, args ...interface{}) error + func (t *FiDB) GetRecordCount(tableName string, query interface{}, values ...interface{}) int64 + func (t *FiDB) Group(query string) *FiDB + func (t *FiDB) Having(query interface{}, values ...interface{}) *FiDB + func (t *FiDB) InsertItem(entityPtr interface{}) error + func (t *FiDB) Joins(query string, args ...interface{}) *FiDB + func (t *FiDB) Limit(limit interface{}) *FiDB + func (t *FiDB) Model(entityPtr interface{}) *FiDB + func (t *FiDB) NewRecord(entity interface{}) bool + func (t *FiDB) Not(query interface{}, args ...interface{}) *FiDB + func (t *FiDB) Offset(offset interface{}) *FiDB + func (t *FiDB) Or(query interface{}, args ...interface{}) *FiDB + func (t *FiDB) Order(value interface{}, reorder ...bool) *FiDB + func (t *FiDB) Pagging(tEntity interface{}, p *Param) *Paginator + func (t *FiDB) Pluck(column string, value interface{}) *FiDB + func (t *FiDB) Raw(sql string, values ...interface{}) *FiDB + func (t *FiDB) RecordNotFound() bool + func (t *FiDB) Row() *sql.Row + func (t *FiDB) Rows() (*sql.Rows, error) + func (t *FiDB) Scan(dest interface{}) *FiDB + func (t *FiDB) ScanMap(sql string, values ...interface{}) ([]map[string]string, error) + func (t *FiDB) ScanObject(sql string, values ...interface{}) ([]map[string]interface{}, error) + func (t *FiDB) Select(query interface{}, args ...interface{}) *FiDB + func (t *FiDB) Set(name string, value interface{}) *FiDB + func (t *FiDB) SetLoger(log logger) + func (t *FiDB) Table(tableName string) *FiDB + func (t *FiDB) Take(out interface{}, where ...interface{}) *FiDB + func (t *FiDB) Update(attrs ...interface{}) error + func (t *FiDB) UpdateColumn(attrs ...interface{}) error + func (t *FiDB) UpdateColumns(entity interface{}) error + func (t *FiDB) UpdateItem(entityPtr interface{}, cols []string) error + func (t *FiDB) Updates(value interface{}) error + func (t *FiDB) Where(query interface{}, args ...interface{}) *FiDB + type FiTX struct + EndFunc func(fiTXCtx FiTXCtx) + Error error + func BeginDBTX(ctx xcontext.XContext) *FiTX + func BeginNamedDBTX(dbName string, ctx xcontext.XContext) *FiTX + func BeginTransaction() *FiTX + func BeginTransactionWithDbName(dbName string) *FiTX + func (t *FiTX) Commit() + func (t *FiTX) EndTransaction() + func (t *FiTX) NewQuery() *FiDB + func (t *FiTX) RollbackTranction() + func (t *FiTX) SetLoger(log logger) + type FiTXCtx struct + ConnectedTime time.Time + ConnectingTime time.Time + ExecutedTime time.Time + ExecutingTime time.Time + TXResult string + type LogWriter interface + Println func(v ...interface{}) + type Logger struct + func (logger Logger) Print(values ...interface{}) + type Paginator struct + Limit int + NextPage int + Offset int + Page int + PrevPage int + TotalPage int + TotalRecord int + type Param struct + Limit int + OrderBy []string + Page int + type TableStruct struct + Default string + Extra string + Field string + Key string + Null string + Type string + func GetTableStructInfo(tableName string) []TableStruct