Hmmm I've recently been evaluating https://www.kysely.dev after finding that Prisma can't support foreign data warehousing (FDW) with Postgres. I don't really know enough about Kysely yet to make an informed opinion between those two. If you know more than me, can you give me your take?? Edit: Hmmm perhaps based on the primary author's other repos ( https://github.com/mythz ) it looks like they're a fan of C#. Perhap…
Right, it's effectively a spiritual port of our C# LINQ OrmLite library [1]. I've been using a lot of bun:sqlite [2] lately which has an amazing DX and lets you create lots of stand-alone .ts scripts (i.e. without deps) to access SQLite DB's. The only issue is that I didn't want all my SQL queries to be coupled to a single driver, so I created litdb to provide a RDBMS-agnostic API + Query Builders so all my queries c…
Litdb – type safe SQL for JavaScript/TS
61–70 of 70 posts
Re: Litdb – type safe SQL for JavaScript/TS
#62Re: Litdb – type safe SQL for JavaScript/TS
#63Ah yes, another ORM pretending to be SQL-like syntax. Uhhhhhh EDIT: They don't even support, not to not mention, CTE! Come on!
Re: Litdb – type safe SQL for JavaScript/TS
#64I'm sure a lot of effort went into this, but I would rather raw dog my database layer with node-postgres/postgres.js and zod. The decorator heavy implementation is visually very busy. Also, I would not consider any SQL toolkit for serious use unless it comes with a sufficiently competent code generation accompaniment.
My feelings are similar and I cringe every time I see a "typesafe" db interface that doesn't run time validate the data.
Re: Litdb – type safe SQL for JavaScript/TS
#65Title makes it seem as if you writr typesafe SQL, but you really use a builder which generates SQL for you. I was expecting something more like sqlx, which I believe provides compile-time checking for SQL queries without a DSL, but for Rust
1. https://github.com/manifold-systems/manifold/blob/master/man...
Re: Litdb – type safe SQL for JavaScript/TS
#66nit: i feel like this is a typesafe sql query builder and not typesafe sql. i'm always on the look out for _good_ typesafe sql which i have yet to encounter.
Agree, I want to write raw SQL and have some tool that validate it and generate the correct return type for it, similar to sqlx[0], but AFAIK there is no such tool yet in Typescript land, there are a few that are taking that direction. [0] https://github.com/launchbadge/sqlx
1. https://github.com/manifold-systems/manifold/blob/master/man...
Re: Litdb – type safe SQL for JavaScript/TS
#67I'm really curious to see new DX for the problem of "type-safe queries with intellisense". Litdb provides SQL-like syntax, but it feels like knowing actual SQL should be enough. If the problem is seen as an editor or build-time problem, rather than a library one, you don't have to learn anything new, and you can save the weight in your dependencies. A fusion of ts-safeql [0] and postgres_lsp [1] is the closest I've s…
I played around with parsing and inferring SQL on a type level. Simple stuff works, but as soon as you have a DB-specific dialect, it becomes hard. Parsing is already hard enough, but type inference on a type level is just not maintainable on the long run. You can find it here: https://github.com/nikeee/sequelts
Re: Litdb – type safe SQL for JavaScript/TS
#68Type-safe query builders sound great in theory, but it seems there are always edge cases that are not supported by the query builder. For example, the issue asking for deferrable constraint support for Postgres in drizzle has been open for about a year: https://github.com/drizzle-team/drizzle-orm/issues/1429 In any non-trivial application, you are increasingly likely to run into something that your database supports…
Re: Litdb – type safe SQL for JavaScript/TS
#69nit: i feel like this is a typesafe sql query builder and not typesafe sql. i'm always on the look out for _good_ typesafe sql which i have yet to encounter.
Agree, I want to write raw SQL and have some tool that validate it and generate the correct return type for it, similar to sqlx[0], but AFAIK there is no such tool yet in Typescript land, there are a few that are taking that direction. [0] https://github.com/launchbadge/sqlx