我需要替换 moor 数据库中特定行的特定列中的值,但我不知道它是查询。你能给我举个例子吗?
问问题
310 次
1 回答
0
这是您想要做的答案是:
Future moveImportantTasksIntoCategory(Category target) {
// for updates, we use the "companion" version of a generated class. This wraps the
// fields in a "Value" type which can be set to be absent using "Value.absent()". This
// allows us to separate between "SET category = NULL" (`category: Value(null)`) and not
// updating the category at all: `category: Value.absent()`.
return (update(todos)
..where((t) => t.title.like('%Important%'))
).write(TodosCompanion(
category: Value(target.id),
),
);
}
如果你看不懂。检查我的例子:
updateHeaderId(String customerCode, int headerId) {
update(offlineOrderLines)
..where((tbl) => tbl.custCode.equals(customerCode))
..write(OfflineOrderLinesCompanion(headerId: Value(headerId)));
}
在上面的示例中,我想更改特定customerCode的headerId。如果您有任何问题,请告诉我。
于 2021-07-24T13:33:39.350 回答