Code review from someone who speaks "Diesel"

#1

What would be the idiomatic way to break the get_post_info functions up so that they’re not duplicating most of their code?

0 Likes

#2

have a function that returns partially filtered output, so that other methods can apply additional conditions and retrieve results.

1 Like

#3

What data type would the function need to return, though? I can’t just return a Vec<PostInfo>; I need to use the database index to look up a few posts out of potentially hundreds of thousands. Probably I would want to return an impl Trait of some sort, but I couldn’t find anything in the guide that says what trait I would use.

0 Likes

#4

Hm, good question. Perhaps ask here: https://gitter.im/diesel-rs/diesel
I’ve got to diesel::query_builder::SelectStatement,
but that’s not the whole answer.

0 Likes

#5

You might find this article interesting
http://diesel.rs/guides/composing-applications/

0 Likes