entc/gen: add SetID to predefined mutation methods (#4061)

This commit is contained in:
Ariel Mashraki
2024-05-19 12:55:27 +03:00
committed by GitHub
parent 7064e58744
commit e56fd86cad

View File

@@ -1208,7 +1208,7 @@ var mutMethods = func() map[string]bool {
// with the mutation methods, prefix the method with "Get".
func (f Field) MutationGet() string {
name := pascal(f.Name)
if mutMethods[name] {
if mutMethods[name] || (name == "SetID" && f.typ.ID.UserDefined) {
name = "Get" + name
}
return name