โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โโโ โโโ โโโ โโโ โโโโโโ
โโโ โโโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโโ โโโ โโโโโโ
โโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโ
โโโ โโโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโ โโโ โโโโโโโโโโโโโโโโโโโ
โโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโโ
โโโ โโโโโโโโโโโโโ โโโโโโโโโโโโโ โโโ โโโโโโโโโโโโโ
โ โโโโโโโโโโโ โโโโโโโโโโโ โ โโโโโโโโโโโ
This is a SQL database implemented purely in TypeScript type annotations.
This means that it operates solely on types - you define a "database"
(just a type annotation) and then query it using some more type annotations.
It supports a subset of SQL, including SELECT (with conditions and joins), INSERT, UPDATE and DELETE statements.
You can install ts-sql in your own project with npm install @codemix/ts-sql or
yarn add @codemix/ts-sql (TypeScript 4.1 is required).
An example query looks like this:
import { Query } from "@codemix/ts-sql";
const db = {
things: [
{ id: 1, name: "a", active: true },
{ id: 2, name: "b", active: false },
{ id: 3, name: "c", active: true },
],
} as const;
type ActiveThings = Query<
"SELECT id, name AS nom FROM things WHERE active = true",
typeof db
>;
// ActiveThings is now equal to the following type:
type Expected = [{ id: 1; nom: "a" }, { id: 3; nom: "c" }];