Skip to content

Commit 68ff7eb

Browse files
committed
docs(README): update examples for incrBy method with various input types
1 parent cd51a0d commit 68ff7eb

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,22 @@ async function updateExample() {
121121
name: "Joe",
122122
age: 18,
123123
});
124+
125+
// incrBy with number
126+
row = await query.where("name", "Joe").incrBy("age", 1);
127+
128+
// incrBy with string
129+
row = await query.where("name", "Joe").incrBy("age", "1");
130+
131+
// incrBy with Callback
132+
let result = { status: "success" };
133+
row = await query.where("id", 1).incrBy("error_times", () => {
134+
// increase error_times if result.status is not success
135+
if (result.status !== "success") {
136+
return 1;
137+
}
138+
return 0;
139+
});
124140
}
125141

126142
async function deleteExample() {

0 commit comments

Comments
 (0)