News for hackers. Stuff that matters.
Re:Kysely: TypeScript SQL Query Builder by nikeee on Tuesday January 24, 2023 @05:43PM (#34511659)
You can use these template literal types + infer to build an entire SQL parser. I did a POC that infers SQL query types by parsing the SQL query on a type level:

https://github.com/nikeee/sequelts

Building this parser is pretty cumbersome and supporting multiple SQL dialects would be lots of pain. While I'm not a fan of query builders per se, Kysely pretty much covers everything that my POC tried to cover (except that 0 runtime overhead). However, you get the option to use different DBMs in tests than in production (pg in prod, sqlite in tests), which is a huge benefit for a lot of people. sequelts was designed to work with sqlite only. And it's a hack.

There are no comments on this comment yet.