1219 Members
A safe, extensible ORM and Query Builder for Rust49 Servers

Load older messages

Timestamp Message
9 Apr 2020
21:06:22@gitter_weiznich:matrix.orgGeorg Semmler (Gitter) The filter only applies to folders right?
21:06:28@gitter_thoucheese:matrix.orgLuuk Wester (Gitter)Yes
21:07:59@gitter_weiznich:matrix.orgGeorg Semmler (Gitter)

In that case you could do something like the following:
let query = folders::table.filter(whatever);

if is_request_metadata {
let res = query.left_join(folder_meta::table).get_results(conn);
// handle res with metadata here
} else {
let res = query.get_results(conn);
// handle res without metadata here

21:08:13@gitter_weiznich:matrix.orgGeorg Semmler (Gitter) (edited) ... } => ... } ```
21:09:20@gitter_thoucheese:matrix.orgLuuk Wester (Gitter)That is a good idea!
21:09:25@gitter_thoucheese:matrix.orgLuuk Wester (Gitter)Thanks for your help
21:09:37@gitter_thoucheese:matrix.orgLuuk Wester (Gitter)I really should take the deep dive into diesel a bit more
21:12:11@gitter_weiznich:matrix.orgGeorg Semmler (Gitter) No worries, asking questions here is totally fine (That's the place for asking questions about diesel :wink:)
(I just happen to have "some" experience to make stuff with diesel work :wink:)
21:12:52@gitter_weiznich:matrix.orgGeorg Semmler (Gitter)So if you hit another problem feel free to ask again.
21:23:30@gitter_thoucheese:matrix.orgLuuk Wester (Gitter)Hahaha, I hope to get there one day!
21:23:31@gitter_thoucheese:matrix.orgLuuk Wester (Gitter)Thanks
21:25:15@gitter_weiznich:matrix.orgGeorg Semmler (Gitter) To do a bit of self promotion: I've done a workshop on diesel at the last rustfest in barcelona. The slides are available here. I think the have at least some information about what's possible and how things works internally.
21:35:59@gitter_thoucheese:matrix.orgLuuk Wester (Gitter)Ah nice!
21:36:07@gitter_thoucheese:matrix.orgLuuk Wester (Gitter)Ill read this
21:36:33@gitter_thoucheese:matrix.orgLuuk Wester (Gitter) Provided custom derive, mapping is done by order, not by name
21:37:02@gitter_thoucheese:matrix.orgLuuk Wester (Gitter)What is the reason for this decision?
21:38:06@gitter_weiznich:matrix.orgGeorg Semmler (Gitter) a) It's faster
b) Not every field returned by the database has a name
c) We do not have any access to the field names there anyway
21:38:48@gitter_weiznich:matrix.orgGeorg Semmler (Gitter)(In practice you will likely get a compiler error if you mix up the field order anyway)
21:39:16@gitter_thoucheese:matrix.orgLuuk Wester (Gitter)Ah okay!
21:40:00@gitter_thoucheese:matrix.orgLuuk Wester (Gitter) So if I have a table with four columns and a struct with two fields, that happen to be the two last ones, I need to write .select when using that struct?
21:40:22@gitter_weiznich:matrix.orgGeorg Semmler (Gitter) Yes
10 Apr 2020
08:54:56@gitter_saidaspen:matrix.orgSaid Aspen (Gitter) joined the room.
08:54:57@gitter_saidaspen:matrix.orgSaid Aspen (Gitter) Hi everyone. New to Diesel and new to Rust. I have a table with uuid as PK and trying to use find on it, however getting this error ^^^^^ the trait diesel::Queryable<diesel::sql_types::Uuid, diesel::pg::Pg> is not implemented for &uuid::Uuid - Anyone have any clue as to why? Is it not possible to query using uuids as PKs?
08:55:50@gitter_weiznich:matrix.orgGeorg Semmler (Gitter) Have you enabled the uuid or the uuidv07 feature for in your cargo.toml for diesel? Do you use a matching uuid version?
09:02:03@gitter_saidaspen:matrix.orgSaid Aspen (Gitter)uuid is enabled for diesel. I am using uuid v4. Not sure they match
09:02:19@gitter_weiznich:matrix.orgGeorg Semmler (Gitter) Which uuid version do you use?
09:02:33@gitter_weiznich:matrix.orgGeorg Semmler (Gitter) If you use another version as diesel it will not work.
09:02:40@gitter_saidaspen:matrix.orgSaid Aspen (Gitter) uuid = { version = "0.6", features = ["serde", "v4"] }
09:06:21@gitter_weiznich:matrix.orgGeorg Semmler (Gitter) That should work fine
Can you provide the corresponding code?
09:06:48@gitter_saidaspen:matrix.orgSaid Aspen (Gitter)Sure. Ill set it up, one second, thanks

There are no newer messages yet.

Back to Room List