nebeker

joined 9 months ago
[–] [email protected] 1 points 5 months ago (1 children)

One of my main concerns with this is the potential for making a lot of separate calls to the DB for a complex data structure. Then again there are trade offs to any architecture.

[–] [email protected] 1 points 5 months ago* (last edited 5 months ago) (3 children)

The insert on their Getting Started guide.

let new_post = NewPost { title, body };

diesel::insert_into(posts::table)
    .values(&new_post)
    .returning(Post::as_returning())
    .get_result(conn)
    .expect("Error saving new post")

Of course the other possibility is this guide is very low on abstractions.

[–] [email protected] 7 points 5 months ago (5 children)

Just learning. I threw together a little CRUD API in Rocket the other day.

Now I’m playing around with Diesel. I don’t love the intermediate New types, coming from EF Core. Is that because Rust ~~~~doesn’t really have constructors?

view more: ‹ prev next ›