We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
entproto
Assume Person has immutable edge to Pet (e.g. Person is owner of Pet). Code for PetService.Update is generated as follow:
Person
Pet
PetService.Update
if pet.GetOwner() != nil { petOwner := int(pet.GetOwner().GetId()) m.SetOwnerID(petOwner) // <- SetOwnerID undefined since the edge is immutable. }
The code if pet.GetOwner() != nil { ... } should not be generated.
if pet.GetOwner() != nil { ... }
// Edges of the Person. func (Person) Edges() []ent.Edge { return []ent.Edge{ edge.To("pets", Pet.Type). Annotations(entproto.Field(2)), } } // Edges of the Pet. func (Pet) Edges() []ent.Edge { return []ent.Edge{ edge.From("owner", Person.Type).Ref("pets").Immutable().Unique().Required(). Annotations(entproto.Field(2)), } }
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Current Behavior 😯
Assume
Person
has immutable edge toPet
(e.g.Person
is owner ofPet
).Code for
PetService.Update
is generated as follow:Expected Behavior 🤔
The code
if pet.GetOwner() != nil { ... }
should not be generated.Steps to Reproduce 🕹
Your Environment 🌎
The text was updated successfully, but these errors were encountered: