Documentation ¶
Index ¶
- func InitDBConfig(maxOpenConns, maxIdleConns int)
- func Now() (now int64)
- type BaseDao
- func (p *BaseDao) Begin() (err error)
- func (p *BaseDao) Commit() (err error)
- func (p *BaseDao) DB() (db *gorm.DB)
- func (p *BaseDao) Delete(query interface{}, args ...interface{}) (effectRows int64)
- func (p *BaseDao) DeleteBy(fieldName string, value interface{}) (effectRows int64)
- func (p *BaseDao) DeleteByID(id interface{}) (effectRows int64)
- func (p *BaseDao) Exec(sql string, args ...interface{}) (affectedRows int64, err error)
- func (p *BaseDao) Find(query interface{}, args ...interface{}) (result interface{}, err error)
- func (p *BaseDao) Get(query interface{}, args ...interface{}) (result interface{})
- func (p *BaseDao) GetShared() (shared *SharedDao)
- func (p *BaseDao) GetSimple(query interface{}, args ...interface{}) (result interface{}, err error)
- func (p *BaseDao) Insert(value interface{}) (err error)
- func (p *BaseDao) MustBegin()
- func (p *BaseDao) MustCommit()
- func (p *BaseDao) MustCount(query string, args ...interface{}) (count int64)
- func (p *BaseDao) MustExec(sql string, args ...interface{}) (affectedRows int64)
- func (p *BaseDao) MustGet(query interface{}, args ...interface{}) (result interface{})
- func (p *BaseDao) MustInsert(value interface{})
- func (p *BaseDao) MustPagingFind(orderBy interface{}, page int, pageSize int, query interface{}, ...) (result interface{})
- func (p *BaseDao) MustQueryInt(sql string, args ...interface{}) (value int64)
- func (p *BaseDao) MustRawFind(rawQuery string, args ...interface{}) (result interface{})
- func (p *BaseDao) MustRawFindModel(model interface{}, rawQuery string, args ...interface{}) (result interface{})
- func (p *BaseDao) MustRawGet(model interface{}, rawQuery string, args ...interface{}) (result interface{})
- func (p *BaseDao) MustRollback()
- func (p *BaseDao) MustSave(value interface{})
- func (p *BaseDao) PagingFind(orderBy interface{}, page int, pageSize int, query interface{}, ...) (result interface{}, err error)
- func (p *BaseDao) QueryInt(sql string, args ...interface{}) (value int64, err error)
- func (p *BaseDao) RawFind(rawQuery string, args ...interface{}) (result interface{}, err error)
- func (p *BaseDao) RawFindModel(model interface{}, rawQuery string, args ...interface{}) (result interface{}, err error)
- func (p *BaseDao) Rollback() (err error)
- func (p *BaseDao) Save(value interface{}) (err error)
- func (p *BaseDao) TableName() (tableName string)
- func (p *BaseDao) UpdateBy(update interface{}, query interface{}, args ...interface{}) (effectRows int64)
- func (p *BaseDao) Upsert(obj interface{}) (operator string, effectRows int64)
- type ITableName
- type SharedDao
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BaseDao ¶
type BaseDao struct {
// contains filtered or unexported fields
}
BaseDao 基础Dao BaseDao 中Must开头的函数, 如果出错会抛出Panic, 错误信息为: baselib.errors.ApiError{Reason: 'ERR_SERVER_ERROR', Errmsg: '错误的具体信息'}
func NewBaseDao ¶
NewBaseDao 创建新的BaseDao, model指定对应的模型类
func NewSharedBaseDao ¶
func (*BaseDao) DeleteByID ¶
DeleteByID 根据id删除.
func (*BaseDao) Get ¶
func (p *BaseDao) Get(query interface{}, args ...interface{}) (result interface{})
Get 功能同GetSimple, 如果出错会导致panic.
func (*BaseDao) MustCommit ¶
func (p *BaseDao) MustCommit()
func (*BaseDao) MustGet ¶
func (p *BaseDao) MustGet(query interface{}, args ...interface{}) (result interface{})
MustGet 功能同Get, 如果未查询到对象, 会panic(ErrObjectNotFound)
func (*BaseDao) MustInsert ¶
func (p *BaseDao) MustInsert(value interface{})
func (*BaseDao) MustPagingFind ¶
func (p *BaseDao) MustPagingFind(orderBy interface{}, page int, pageSize int, query interface{}, args ...interface{}) (result interface{})
MustPagingFind 功能同PagingFind, 如果出错会导致panic.
func (*BaseDao) MustQueryInt ¶
MustQueryInt 功能同QueryInt, 如果出错会导致panic.
func (*BaseDao) MustRawFind ¶
MustRawFind 功能同RawFind, 如果出错会导致panic.
func (*BaseDao) MustRawFindModel ¶
func (p *BaseDao) MustRawFindModel(model interface{}, rawQuery string, args ...interface{}) (result interface{})
MustRawFindModel 功能同RawFindModel, 如果出错会导致panic.
func (*BaseDao) MustRawGet ¶
func (p *BaseDao) MustRawGet(model interface{}, rawQuery string, args ...interface{}) (result interface{})
MustRawGet 使用原始查询,查询单个对象
func (*BaseDao) MustRollback ¶
func (p *BaseDao) MustRollback()
func (*BaseDao) PagingFind ¶
func (p *BaseDao) PagingFind(orderBy interface{}, page int, pageSize int, query interface{}, args ...interface{}) (result interface{}, err error)
PagingFind 支持分页的查询, 返回值result 类型为: *[]Object
func (*BaseDao) RawFindModel ¶
func (p *BaseDao) RawFindModel(model interface{}, rawQuery string, args ...interface{}) (result interface{}, err error)
RawFindModel 使用原生SQL查询(指定结果Model)
Click to show internal directories.
Click to hide internal directories.