Is it possible with SqlBoiler to insert a Team
with it's has-many
Players
using a single insert?
#960
Answered
by
aarondl
frederikhors
asked this question in
Q&A
-
Is it possible with SqlBoiler to insert a Example: team := Team{
name: "Real"
players: []Player{
{name: "John"},
{name: "Frank"}
}
}
err := team.Insert(ctx, db, boil.Infer()) Is this possible? |
Beta Was this translation helpful? Give feedback.
Answered by
aarondl
Jun 7, 2021
Replies: 1 comment
-
There's no bulk-insertion supported by sqlboiler right now, they will always all be a separate query. You could try |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
stephenafamo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There's no bulk-insertion supported by sqlboiler right now, they will always all be a separate query.
You could try
team.AddPlayers(..., true)
which will insert them for you.