proto.update = function* (table, row, options) {
// ......
if (!options.where) {
if (!('id' in row)) {
throw new Error('Can\'t not auto detect update condition, please set options.where, or make sure obj.id exists');
}
options.where = {
id: row.id,
};
}
// ......
同样遇到过这个问题,于是翻了 source :
可以看到,update 时主键必须指定且只能为
id哈哈哈,顺便还发现 error message 写错了:Can’t not … (笑)
@dreamswhite 哈哈😄,我已经用了query的方法直接写sql语句,他这个封装真的不是很好用
欢迎 PR