Code review from someone who speaks "Diesel"

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

https://github.com/notriddle/more-interesting/blob/2127c7df7e7a1029a9e85818d0f7e1773910f576/src/models.rs#L230-L258

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

1 Like

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.

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

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

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.