// @Time : 2020/10/29 8:31 下午 // @Author : bingee package models import ( "github.com/beego/beego/v2/client/orm" ) // 更新 func UpdateByExpr(ptrStructOrTableName interface{}, where, updateParams map[string]interface{}) error { o := orm.NewOrm() qs := o.QueryTable(ptrStructOrTableName) for expr, exprV := range where { qs = qs.Filter(expr, exprV) } _, err := qs.Update(updateParams) return err }