afraid not, I've not done any rust for a while and didn't get as far as wanting a DB for anything I was doing
-
-
Replying to @mountain_ghosts
You should give it a shot when you have some time. It's a query builder that gives you composable pieces, and some code generation to help mapping things to/from structs, without the "try to pretend we can hide your database from you" features that folks have associated w/ ORMs
1 reply 0 retweets 0 likes -
Replying to @sgrif @mountain_ghosts
coming from Python, is it like the non-ORM portion of SQLAlchemy? the core/expression language portion of SQLAlchemy requires you know how to write SQL but lets you compose the query from components (column expressions, predicates, etc)
1 reply 0 retweets 0 likes -
-
One thing to note, we have a focus on type safety as well. e.g. if your program compiles, you won't get runtime DB errors (stronger guarantees for select statements than insert/update/delete, triggers are turing complete after all).
1 reply 0 retweets 0 likes -
This will make your code way more resilient, but also harder to make generic (e.g. a function that takes any table with a column called "name" is really difficult to express. Reach for a macro in that case).
1 reply 0 retweets 0 likes -
We also focus less on DB agnostic code. It's possible, but more targeted towards library authors (dev/prod parity is good). We want you to use the features of your database to their full potential
1 reply 0 retweets 0 likes -
Replying to @sgrif @mountain_ghosts
Is there a way to write a diesel query interactively, or does it more or less come down to iterating on a `fn main(){ ... }` until you get something that works, then move what you've learned into your app?
1 reply 0 retweets 0 likes -
Replying to @deanc @mountain_ghosts
Right now it's pretty much the latter. There's some room for improvement in tooling, but it's hard to do much interactively without a better REPL story for Rust. That said, our query builder trends close to the corresponding SQL, so if you know the SQL it's an easy translation
1 reply 0 retweets 1 like -
If you want to see all the warts, https://github.com/rust-lang/crates.io/blob/06bbe1fd16559b874bbb848f5713d13d445fbda0/src/controllers/krate/search.rs#L35-L232 … is one of the worst case scenarios (execute completely different queries based on a param in the URL), and one of the gnarliest examples out there.
2 replies 0 retweets 0 likes
https://github.com/rust-lang/crates.io/blob/06bbe1fd16559b874bbb848f5713d13d445fbda0/src/controllers/krate/metadata.rs#L42-L77 … is probably one of the nicer semi-complex cases (maybe not putting it in its best light, but I remember the code I hate more than the code I'm proud of)
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.