package db import ( "applet/app/db/model" "xorm.io/xorm" ) type MasterAmountFlowDb struct { Db *xorm.Engine `json:"db"` } func (masterAmountFlowDb *MasterAmountFlowDb) Set() { // set方法 masterAmountFlowDb.Db = ZhimengDb } func (masterAmountFlowDb *MasterAmountFlowDb) MasterAmountListUpdate(id int, data *model.MasterAmountFlow) bool { get, err := masterAmountFlowDb.Db.Where("id=?", id).Update(data) if get == 0 || err != nil { return false } return true } func (masterAmountFlowDb *MasterAmountFlowDb) MasterAmountFlowInsert(data *model.MasterAmountFlow) bool { get, err := masterAmountFlowDb.Db.InsertOne(data) if get == 0 || err != nil { return false } return true } func MasterAmountFlowInsertWithSess(sess *xorm.Session, data *model.MasterAmountFlow) bool { get, err := sess.InsertOne(data) if get == 0 || err != nil { return false } return true }