Documentation ¶
Index ¶
- type IServInterface
- type Serv
- func (s Serv) Create(req interface{}, model interface{}) (err error)
- func (s Serv) DeleteByIds(ids []uint, model interface{}) (err error)
- func (s Serv) Exec(fmtSqlStr string) (err error)
- func (s Serv) Find(query *gorm.DB, page *models.PageInfo, model interface{}) (err error)
- func (s Serv) FindById(id uint, model interface{}) (err error)
- func (s Serv) FindByIds(ids []uint, model interface{}) (err error)
- func (s Serv) FindByKeys(key string, ids interface{}, model interface{}) (err error)
- func (s Serv) FindByKeysWithPreload(key string, preloads []string, ids interface{}, model interface{}) (err error)
- func (s Serv) Scan(query *gorm.DB, page *models.PageInfo, model interface{}) (err error)
- func (s Serv) UpdateById(id uint, req interface{}, model interface{}) (err error)
- func (s Serv) UpdateById2(id uint, req interface{}, model interface{}) (m map[string]interface{}, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IServInterface ¶
type IServInterface interface { Exec(fmtSqlStr string) (err error) Create(req interface{}, model interface{}) (err error) UpdateById(id uint, req interface{}, model interface{}) (err error) UpdateById2(id uint, req interface{}, model interface{}) (m map[string]interface{}, err error) DeleteByIds(ids []uint, model interface{}) (err error) FindById(id uint, model interface{}) (err error) FindByIds(ids []uint, model interface{}) (err error) FindByKeys(key string, ids interface{}, model interface{}) (err error) FindByKeysWithPreload(key string, preloads []string, ids interface{}, model interface{}) (err error) Find(query *gorm.DB, page *models.PageInfo, model interface{}) (err error) Scan(query *gorm.DB, page *models.PageInfo, model interface{}) (err error) }
func NewBaseService ¶
func NewBaseService() IServInterface
type Serv ¶
基础数据库单表操作
func (Serv) DeleteByIds ¶
DeleteByIds 批量删除, model需使用指针, 否则可能无法插入数据
func (Serv) FindByKeys ¶
FindByKeys 查询指定key列表, model需使用指针, 否则可能无法绑定数据(如不使用cache可设置为false)
func (Serv) FindByKeysWithPreload ¶
func (s Serv) FindByKeysWithPreload(key string, preloads []string, ids interface{}, model interface{}) (err error)
FindByKeysWithPreload 查询指定key列表, 并且preload其他表, model需使用指针, 否则可能无法绑定数据(如不使用cache可设置为false)
func (Serv) UpdateById ¶
Click to show internal directories.
Click to hide internal directories.