|
1234567891011121314151617181920212223242526272829 |
- package db
-
- import (
- "applet/app/db/model"
- "xorm.io/xorm"
- )
-
- func DetailInsert(Db *xorm.Engine, data *model.CommunityTeamStorePrinterDetail) (int64, error) {
- affected, err := Db.InsertOne(data)
- if err != nil {
- return 0, err
- }
- return affected, nil
- }
- func DetailUpdate(Db *xorm.Engine, id interface{}, data *model.CommunityTeamStorePrinterDetail, forceColums ...string) (int64, error) {
- var (
- affected int64
- err error
- )
- if forceColums != nil {
- affected, err = Db.Where("id=?", id).Cols(forceColums...).Update(data)
- } else {
- affected, err = Db.Where("id=?", id).Update(data)
- }
- if err != nil {
- return 0, err
- }
- return affected, nil
- }
|