Versions in this module Expand all Collapse all v1 v1.0.0 May 9, 2024 Changes in this version + func Init(cfg *Config) (err error) + type ColumnFilter struct + func NewEqualFilter(column string, value interface{}) ColumnFilter + func NewGreaterFilter(column string, value interface{}) ColumnFilter + func NewInFilter(column string, value interface{}) ColumnFilter + func NewLikeFilter(column string, value string) ColumnFilter + type Config struct + Host string + Life int + MaxConn int + MaxIdle int + Name string + Port int + Pwd string + User string + func (cfg *Config) SetDefault() + type DbTable struct + func NewDBTable(name string) DbTable + func (t DbTable) AutoMigrate(dst interface{}) error + func (t DbTable) Count(filter []ColumnFilter) (int, error) + func (t DbTable) DB() *gorm.DB + func (t DbTable) ExecSQL(sql string, result interface{}, args ...interface{}) error + func (t DbTable) FirstOrCreate(filter, result interface{}) error + func (t DbTable) FirstOrCreateWithNot(filter, notFilter, result interface{}) error + func (t DbTable) GetRecord(filter, result interface{}) error + func (t DbTable) GetRecords(filter []ColumnFilter, result interface{}, p Pagination, sort []SortByColumn) (err error) + func (t DbTable) Insert(result interface{}) error + func (t DbTable) IsRowExists(err error) bool + func (t DbTable) IsRowNotFound(err error) bool + func (t DbTable) UpdateRecord(filter, update interface{}) (err error) + type Pagination struct + CountPerPage int + PageNum int + type SortByColumn struct + Ascend bool + Column string