跳到正文

正在自动登录…

← 返回项目列表

colinhacks/reylo

SQL导入类型推断

Reylo 是一个让 TypeScript 代码直接导入 .sql 文件的工具,通过类型推断将 SQL 查询的类型安全地集成到 TypeScript 编译中,无需生成代码。适合希望将数据库查询与类型系统紧密结合的开发者。

AI 中文解读 · 根据仓库描述与 README 生成 · 2026/10/22 19:36:47 · 查看原文

值得看Rust开发工具
累计 Stars
358
当前热度
1~7 天 · 小火
仓库创建时间
打开 GitHub ↗项目网站 ↗

选用指南

AI 根据 README 整理 · 2026/10/22 19:36:47

使用方式

通过 npm 安装,在 tsconfig.json 中配置 contentMappers,并使用 --runExternalCode 进行类型检查。运行时需要加载 reylo/register 或使用相应插件。

查看 README 依据
- ⚡ **No codegen** — the type checker asks Reylo directly: no generated files, no watcher. ## Setup To install Reylo, you'll need: - **TypeScript 7.1 (currently in beta).** The first release with content mappers. - **Node 24 or later.** - **A running dev database.** Postgres, MySQL 8.0.22 or later, or a SQLite file: Reylo reads your current schema from it. On Postgres and SQLite, [a schema file](https://reylo.dev/#schema-files) will do instead. Install Reylo, the engine for your database and TypeScript 7.1: ```sh npm install reylo npm install -D @reylosql/postgres # or mysql, sqlite
npm install -D typescript@beta ``` Add Reylo to `tsconfig.json`: ```jsonc // tsconfig.json { "compilerOptions": { /* ... */ }, "contentMappers": [ { "package": "reylo", "extensions": [".sql"] } ] } ``` Then type-check with `--runExternalCode`, which lets `tsc` run content mappers: ```jsonc // package.json { "scripts": { "typecheck": "tsc --noEmit --runExternalCode" } } ``` Point Reylo at your dev database with `DATABASE_URL`, in your environment or in `.env`: ```sh # .env DATABASE_URL=postgres://localhost:5432/app # or mysql://…, or file:./app.db for SQLite ```
To make `.sql` imports work at run time too, load Reylo where your code runs. On Node: ```sh node --env-file=.env --import reylo/register main.ts ``` For Bun, Nub, Vite, Next.js, esbuild, webpack, Rspack, Cloudflare Workers and Jest, add [the plugin for your setup](https://reylo.dev/#plugins), or copy its complete [example project](https://github.com/colinhacks/reylo/tree/main/examples). To see the types as you type, set up [your editor](https://reylo.dev/#editors). ## Usage Write a query in a `.sql` file, import it, and run it with your database driver: ```sql -- get_user.sql
部署要求

需要 TypeScript 7.1(目前处于 beta 版)、Node 24 或更高版本,以及一个运行中的开发数据库(Postgres、MySQL 8.0.22+ 或 SQLite 文件)。

查看 README 依据
- ⚡ **No codegen** — the type checker asks Reylo directly: no generated files, no watcher. ## Setup To install Reylo, you'll need: - **TypeScript 7.1 (currently in beta).** The first release with content mappers. - **Node 24 or later.** - **A running dev database.** Postgres, MySQL 8.0.22 or later, or a SQLite file: Reylo reads your current schema from it. On Postgres and SQLite, [a schema file](https://reylo.dev/#schema-files) will do instead. Install Reylo, the engine for your database and TypeScript 7.1: ```sh npm install reylo npm install -D @reylosql/postgres # or mysql, sqlite
已知限制

Reylo 需要 TypeScript 7.1(目前处于 beta 版)和 Node 24 或更高版本。

查看 README 依据
- ⚡ **No codegen** — the type checker asks Reylo directly: no generated files, no watcher. ## Setup To install Reylo, you'll need: - **TypeScript 7.1 (currently in beta).** The first release with content mappers. - **Node 24 or later.** - **A running dev database.** Postgres, MySQL 8.0.22 or later, or a SQLite file: Reylo reads your current schema from it. On Postgres and SQLite, [a schema file](https://reylo.dev/#schema-files) will do instead. Install Reylo, the engine for your database and TypeScript 7.1: ```sh npm install reylo npm install -D @reylosql/postgres # or mysql, sqlite

README

正在加载 README…

收录信息

仓库创建时间
2026/10/21 08:16:54
首次达标收录
2026/10/22 19:31:30
统计更新时间
2026/10/22 20:41:11

按创建时长与累计 Stars 判断等级。首次达标收录后,即使未达当前门槛仍保留;累计 Stars 和仓库状态会定期更新。确认只有 README 及辅助文件的仓库会停止公开。

模型评估

值得看加权总分 3.9 / 5

新颖度
4.1
实用价值
4.1
成熟度
4.2
实质含量
3.3

由 Jev 模型根据仓库描述与 README 评估,2026/10/22 19:31:30 生成。评分仅供参考,不是代码、安全或许可证审查;热度等级另按创建时长与累计 Stars 计算。

仓库信息

最近推送
2026/10/22 15:46:47
许可证标识
MIT
Fork 数
2
当前状态
未归档

收录记录

按创建时长与累计 Stars 首次收录:小火
首次发现项目