reylo:把.sql直接import进TypeScript,类型从库里推

colinhacks/reylo让你在TypeScript里直接import .sql文件,参数、列、可空性和行数类型从实时Postgres/MySQL/SQLite schema推断,不走传统codegen;依赖TypeScript 7.1 beta的content mappers。[1]

作者是Zod作者Colin。官网示例是getAuthor.run(db,{id:1})这种写法,编辑器悬停能看到行类型。适合Agent改SQL时不想落下过期手写类型的团队。

仓库:https://github.com/colinhacks/reylo 文档:https://reylo.dev/

你们还在手写Row类型,还是已经上Drizzle/Prisma?

[1] Reylo,项目文档;GitHub colinhacks/reylo。

#reylo #TypeScript #SQL #类型推断 #开源