kuru-kuru/shared/db.ts
Ayase Minori 1a42b2ccf0
Finally figure out how to increment this lol
Signed-off-by: GitHub <noreply@github.com>
2023-09-12 06:38:05 +00:00

11 lines
325 B
TypeScript

const kv = await Deno.openKv();
export async function getGlobalStatistics() {
const res = await kv.get<number>(["global-statistics"]) ?? 0;
return res.value ?? 0;
}
export async function setGlobalStatistics(value: number) {
const pv = await getGlobalStatistics();
await kv.set(["global-statistics"], pv + value);
}