Hacker News new | ask | show | jobs
by hyperbrainer 320 days ago
I have never used SQLx, but the best SQL integration I can think of is LINQ. How does this compare to that?
2 comments

In the dotnet world, SQLx is more analogous to F# type providers like FSharp.Data.SqlClient , SQLProvider or Rezoom.SQL.
Different products. I would not compare them. LINQ is more like Diesel (https://diesel.rs/)
To expand, SQLx isn't an ORM or query builder, what it does is allow you to write raw SQL with compile-time guarantees of type safety. It does this by connecting to a dev database at compile time & uses SQL's introspection features (specifically, by preparing a statement[1]) to analyze your queries. (It can also cache this information to check without a database available, and has a basic migration facility.)

[1] https://github.com/launchbadge/sqlx/blob/main/FAQ.md#how-do-...