kuru-kuru/shared/db.ts
Ayane Satomi 238c01bcd7 feat: Update globalCount type to bigint
Update globalCount type from number to bigint in CounterCard and index files, and in setGlobalStatistics function
2023-10-22 05:56:36 +00:00

11 lines
317 B
TypeScript

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