easrng/kyselyVtDemo

Forks

Forked 2 times

Kysely on val.town

Uses @easrng/kyselyVtDialect as a Kysely Dialect and @easrng/kyselyVtTypes for type autogeneration.

Readme
1
2
3
4
5
6
7
8
9
10
11
import type { DB } from "https://easrng-kyselyvttypes.web.val.run/?tables=contacts";
import { VtDialect } from "https://esm.town/v/easrng/kyselyVtDialect";
import { Kysely } from "npm:kysely@0.27.3";
// ^ pinned version because val.town's editor doesn't
// load version ranges.
const db = new Kysely<DB>({
dialect: new VtDialect(),
});
const rows = await db.selectFrom("contacts").selectAll().execute();
// ^ { contact_id: number; email: string; first_name: string; ... }[]
console.log(rows);
1
2
3
4
5
6
7
8
9
10
11
import { VtDialect } from "https://esm.town/v/easrng/kyselyVtDialect";
import type { DB } from "https://nbbaier-kyselyVtTypes.web.val.run/?tables=users";
import { Kysely } from "npm:kysely@0.27.3";
// ^ pinned version because val.town's editor doesn't
// load version ranges.
const db = new Kysely<DB>({
dialect: new VtDialect(),
});
const rows = await db.selectFrom("users").selectAll().where("id", "=", "1").execute();
// ^ { contact_id: number; email: string; first_name: string; ... }[]
console.log(rows);
1
Next