1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo?v=26";
import { sqliteStore } from "https://esm.town/v/vladimyr/keyvhqSqlite";
import Keyv from "npm:@keyvhq/core";
const { slug } = extractValInfo(import.meta.url);
const keyv = new Keyv({ store: sqliteStore, namespace: slug });
await keyv.set("example", "hello keyv!");
console.log(await keyv.has("thisKeyDoesNotExist"));
console.log(await keyv.has("example"));
console.log(await keyv.get("example"));
{
const { sqlite } = await import("https://esm.town/v/std/sqlite?v=5");
const { zip } = await import("https://esm.town/v/pomdtr/sql");
const result = await sqlite.execute("select * from keyv");
console.table(zip(result));
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
April 1, 2024