Skip to content
Discussion options

You must be logged in to vote

My query doesn't work like that, but this was the closest I got.

First of all: The query you've included in your post is not valid at all. It will not return a Vec<(Movie, Vec<Actor>)>, as SQL just don't work like that. SQL queries return only plain records, so something like Vec<(Movie, Actor)>, which duplicates Movie for any matching actor. That's a fundamental property of how databases work and that's nothing any library builded on top can ever change.

A naive approach for loading data into the structure you like, would be to issue multiple queries. The first query would load all wanted movies and "just" initialize the actor field with some default value. Then you would loop over all…

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@jb-alvarado
Comment options

Answer selected by jb-alvarado
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants