kuru-kuru/shared/db.ts
Ayase Minori 51556f2c9f Initial Commit
Signed-off-by: Ayase Minori <chinodesuuu@gmail.com>
2023-09-10 20:22:22 +08:00

17 lines
366 B
TypeScript

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