diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2023-04-15 10:33:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-15 10:33:31 +0200 |
commit | 2184103a5ec7d7ae6fcfe2ecb79ad481498f5f8d (patch) | |
tree | 253be8ff59e04bb1ea0a9a8a7244bcbed420486e /ext/kv/01_db.ts | |
parent | 1bca994143b4812979a264f1105ae36de1efb982 (diff) |
feat(kv): AtomicOperation#sum (#18704)
Diffstat (limited to 'ext/kv/01_db.ts')
-rw-r--r-- | ext/kv/01_db.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/kv/01_db.ts b/ext/kv/01_db.ts index 38dcb4ae0..16099c225 100644 --- a/ext/kv/01_db.ts +++ b/ext/kv/01_db.ts @@ -211,6 +211,14 @@ class AtomicOperation { return this; } + sum(key: Deno.KvKey, n: bigint): this { + return this.mutate({ + type: "sum", + key, + value: new KvU64(n), + }); + } + mutate(...mutations: Deno.KvMutation[]): this { for (const mutation of mutations) { const key = mutation.key; |