prisma-client-go
prisma-client-go copied to clipboard
Linking multiple many-to-many in one go
In the typescript client we are able to do something like:
Where we send in an array of models to respective field (genre, cast etc).
I saw some discussion in #207 but it doesn't really apply to my needs.
What I've done locally is to add a statement Connect that takes and array of the correct model and creates links automatically.
This is how I use it:
First create all the arrays (for instance genre)
Then send it in a Connect statement
Is this something that could be of use?
How is this different from using .Link() and appending the to the query params? Wouldn't that work with the existing .Link()? Except for that you wouldn't use a models array but a params with the id array
It's mostly a convenience thing (not having to iterate over the created genres to extract id in the app). In the back it does indeed add the genre ids in an array
Hm ok. Not really important IMO but let's keep it open and I'll think about it later