RelateConfig GORMTag Wrong Type in Documentation #6580
Unanswered
hasan-kesserwan
asked this question in
Q&A
Replies: 1 comment
-
use the following code: gen.FieldRelate(field.HasMany, "CreditCards", card, &field.RelateConfig{
// RelateSlice: true,
GORMTag: field.GormTag{"foreignKey": []string{"CustomerRefer"}},
}), |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello 👋
First of all thank you for the amazing tool you created, it helped me a lot.
One thing just confuses me that in the gen tool documentation to define an association in the GenerateModel function it goes like this:
`card := g.GenerateModel("credit_cards")
customer := g.GenerateModel("customers", gen.FieldRelate(field.HasMany, "CreditCards", card,
&field.RelateConfig{
// RelateSlice: true,
GORMTag: "foreignKey:CustomerRefer",
}),
)
g.ApplyBasic(card, custormer)`
but when trying to that in my code it's showing that the GORMTag field is not a string, it is of type GORMTag which is map[string][]string, can you please provide me with an example I can relate to to define an association here, thank you.
Beta Was this translation helpful? Give feedback.
All reactions