From 2184103a5ec7d7ae6fcfe2ecb79ad481498f5f8d Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sat, 15 Apr 2023 10:33:31 +0200 Subject: feat(kv): AtomicOperation#sum (#18704) --- ext/kv/01_db.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ext') 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; -- cgit v1.2.3