Hacker News new | ask | show | jobs
by nathas 566 days ago
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#. Perhaps it's the LINQ-like syntax that separates them the most.

1 comments

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 could easily be run on different DBs.

TypeScript has an amazingly powerful type system which let me build the ideal abstraction I wanted where I could use expressive SQL Expressions but still have typed references to our App's classes (tables) / properties (columns) to benefit from static analysis/intelli-sense during development whilst making it safe to refactor / find references / etc.

Things that are hard/impossible in C# is easy in TypeScript, e.g. the QueryBuilders lets you have a variable number of generic args which isn't possible in C# also it was much easier to support composable queries [3] than trying to combine multiple LINQ queries with shared references.

[1] https://docs.servicestack.net/ormlite/

[2] https://bun.sh/docs/api/sqlite

[3] https://litdb.dev/#composable

Thanks for the detailed explanation! I think it would be great to drop this (or something like this) in the project README.