Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: