1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { Statement } from "https://esm.town/v/postpostscript/sqliteBuilder";
import { sqliteDump } from "https://esm.town/v/postpostscript/sqliteDump";
import { sqliteServe } from "https://esm.town/v/postpostscript/sqliteServe";
import { createSqlite } from "https://esm.town/v/postpostscript/sqliteWasm";
export const {
execute,
batch,
sqlite: sqlitePublic,
handler,
} = sqliteServe(async () => {
const dump = await sqliteDump({
tables: ["authIdExampleComments_comment"],
subset: {
authIdExampleComments_comment:
Statement`SELECT * FROM authIdExampleComments_comment WHERE username = "postpostscript"`,
},
});
const sqlite = createSqlite();
sqlite.batch(dump);
return sqlite;
});
export default handler;
👆 This is a val. Vals are TypeScript snippets of code, written in the browser and run on our servers. Create scheduled functions, email yourself, and persist small pieces of data — all from the browser.