#Should I use a rust ORM or a js one (drizzle)?

8 messages · Page 1 of 1 (latest)

cloud marsh
#

currently I am experimenting with using drizzle orm and tauri-plugin-sqlite but I am running into a lot of issues because there is no official adapter for the sqlite driver, I am wondering how people use the sqlite plugin, I want an orm for type safety so I have two options

  1. Continue using drizzle and figure out a way to expose the sqlite database over http
  2. Use something like diesel on the rust side and expose the data via commands

There are obvious pros and cons to each solution but I am wondering if anyone here has experience with one of those approaches

fathom kestrel
#

I've tried using something a little less than an ORM in JS before (I believe it was kysely purely for its query building feature?) and over the time I tried to work with it the tauri sqlite plugin felt more and more like a sort of "hack" to me. It is great if you're just trying to get something quick and dirt working but I've had more luck doing as much as I can on the Rust side.

Personally I've been using sqlx instead of diesel; You still get type safety in the sense that the things coming into and out of your command are typed (and you have Rust's strict type stuff when writing the command itself) but sqlx is less of a "full ORM". It expects you to write queries manually but comes with a feature that lets you check your queries for errors at compile time (IIRC it will run your queries in a rolled-back transaction to check if they would work in theory).

cloud marsh
#

sqlx is good enough for me, thanks for the repo I am gonna check it out

deft flax
#

The lack of the drizzle tauri adapter is the reason why i choose kysely

rose storm
#

Personally I don't like orm in Rust. Too much strictly
I like to use sql plugin + sqlx + compile time guards macros of for quries of sqlx

fathom kestrel