根据指定的表和id条件更新表字段,不支持批量更新 @param table 需要更新的表 @param data 需要更新的字段 @param filter 过滤条件,如"Id__in" @param filterValue 过滤条件的值 @return affected 影响的记录数 @return err
(table string, data map[string]interface{}, filter string, filterValue ...interface{})
| 170 | //@return affected 影响的记录数 |
| 171 | //@return err 错误 |
| 172 | func UpdateByField(table string, data map[string]interface{}, filter string, filterValue ...interface{}) (affected int64, err error) { |
| 173 | return orm.NewOrm().QueryTable(getTable(table)).Filter(filter, filterValue...).Update(data) |
| 174 | } |
| 175 | |
| 176 | //设置字段值减小 |
| 177 | //@param table 需要操作的数据表 |