schema/field: fix annotations doc example (#1878)

* schema/field: Fix annotation doc example

* Update numeric.tpl
This commit is contained in:
Mohammed Salman
2021-08-26 20:31:11 +03:00
committed by GitHub
parent 30fc87de7f
commit 51ddb405fb
3 changed files with 15 additions and 43 deletions

View File

@@ -22,7 +22,7 @@ func main() {
log.Fatal("reading template file:", err)
}
intTmpl := template.Must(template.New("numeric").
Funcs(template.FuncMap{"title": strings.Title, "hasPrefix": strings.HasPrefix}).
Funcs(template.FuncMap{"title": strings.Title, "hasPrefix": strings.HasPrefix, "toUpper": strings.ToUpper}).
Parse(string(buf)))
b := &bytes.Buffer{}
if err := intTmpl.Execute(b, struct {

View File

@@ -208,9 +208,7 @@ func (b *{{ $builder }}) GoType(typ interface{}) *{{ $builder }} {
// codegen extensions.
//
// field.{{ $tt }}("{{ $t }}").
// Annotations(entgql.Config{
// Ordered: true,
// })
// Annotations(entgql.OrderField("{{ $t.String | toUpper }}"))
//
func (b *{{ $builder }}) Annotations(annotations ...schema.Annotation) *{{ $builder }} {
b.desc.Annotations = append(b.desc.Annotations, annotations...)
@@ -379,9 +377,7 @@ func (b *{{ $builder }}) GoType(typ interface{}) *{{ $builder }} {
// codegen extensions.
//
// field.{{ $tt }}("{{ $t }}").
// Annotations(entgql.Config{
// Ordered: true,
// })
// Annotations(entgql.OrderField("{{ $t.String | toUpper }}"))
//
func (b *{{ $builder }}) Annotations(annotations ...schema.Annotation) *{{ $builder }} {
b.desc.Annotations = append(b.desc.Annotations, annotations...)