Skip to content

Commit

Permalink
entgql/templates: ability to add extra fields and methods to mutation…
Browse files Browse the repository at this point in the history
… inputs (ent#608)

* ability to add additonal fields to mutation input

* Update mutation_input.tmpl removed the model keyword
  • Loading branch information
khanakia authored and acdifran committed Feb 5, 2025
1 parent 7a51db3 commit 9261d31
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions entgql/template/mutation_input.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ import (
{{- end }}
{{- end }}
{{- end }}

{{- with $tmpls := matchTemplate "helper/gql_mutation_input/fields/*" }}
{{- range $tmpl := $tmpls }}
{{- xtemplate $tmpl $n }}
{{- end }}
{{- end }}
}

// Mutate applies the {{ $input }} on the {{ $n.MutationName }} builder.
Expand Down Expand Up @@ -110,6 +116,12 @@ import (
{{- end }}
{{- end }}
{{- end }}

{{- with $tmpls := matchTemplate "helper/gql_mutation_input/mutate/*" }}
{{- range $tmpl := $tmpls }}
{{- xtemplate $tmpl $n }}
{{- end }}
{{- end }}
}

{{- range $b := $n.Builders }}
Expand Down

0 comments on commit 9261d31

Please sign in to comment.