You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type Team struct {
ID uuid.UUID
Members []string
(other Team fields)
}
Which would break out into the following schema:
Table "team"
ID UUID primary key
other fields
Table "team_members"
ID UUID
Member string
Composite Primary Key (ID,Member)
Is there a way to do this?
I thought about making a named Member type that was just a string, and then having a slice of that, but I think that ends up being the same problem. Having a struct Member that just has a Username string would end up with 3 tables probably, which seems excessive. This should be able to be done in two tables, I just don't know how.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
The struct I have in mind is
Which would break out into the following schema:
Table "team"
ID UUID primary key
other fields
Table "team_members"
ID UUID
Member string
Composite Primary Key (ID,Member)
Is there a way to do this?
I thought about making a named Member type that was just a string, and then having a slice of that, but I think that ends up being the same problem. Having a struct Member that just has a Username string would end up with 3 tables probably, which seems excessive. This should be able to be done in two tables, I just don't know how.
Any advice would be appreciated, thank you!
Beta Was this translation helpful? Give feedback.
All reactions