package db import ( "applet/app/db/model" "errors" "xorm.io/xorm" ) // InertSysPushAppOne is 插入一条记录在 表sys_push_app func InertSysPushAppOne(Db *xorm.Engine, m *model.SysPushApp) (int64, error) { affect, err := Db.InsertOne(m) if err != nil { return 0, err } return affect, nil } //UpdateSysPushApp is 更新某条记录 func UpdateSysPushApp(Db *xorm.Engine, m *model.SysPushApp) (int64, error) { affect, err := Db.ID(m.Id).Update(m) if err != nil { return 0, err } return affect, nil } //SysPushAppByID is 根据id 获取对应的推送信息 func SysPushAppByID(Db *xorm.Engine, id interface{}) (*model.SysPushApp, error) { m := new(model.SysPushApp) has, err := Db.ID(id).Get(m) if err != nil { return nil, err } if !has { return nil, errors.New("Not Found") } return m, nil }