mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
schema/field: fix annotations doc example (#1878)
* schema/field: Fix annotation doc example * Update numeric.tpl
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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...)
|
||||
|
||||
Reference in New Issue
Block a user