Intro
Learn how to set up and use tSQL, a type-safe SQL query builder for TypeScript.
Introduction
tSQL is a type-safe SQL query builder and database toolkit for TypeScript.
const users = await db
.selectFrom("users")
.select(["id", "name", "email"])
.execute();
// users is now typed as { id: number; name: string; email: string }[]
Features
- Fluent API: Fully type-safe SQL query builder with a fluent API.
- Automatic Type Generation: Automatic type generation from your database schema.
- Multi-Dialect Support: Compatible with popular SQL databases including PostgreSQL, MySQL, SQLite, and MSSQL.
Acknowledgements
tSQL builds upon the excellent work of the following open-source projects:
- Kysely: A type-safe SQL query builder for TypeScript.
- kysely-codegen: A code generator for Kysely.
We are grateful to the maintainers and contributors of these projects.
License
MIT