54 lines
No EOL
1.5 KiB
Cheetah
54 lines
No EOL
1.5 KiB
Cheetah
{{/* Tell Intellij/GoLand to enable the autocompletion based on the *gen.Graph type. */}}
|
|
{{/* gotype: entgo.io/ent/entc/gen.Graph */}}
|
|
|
|
{{ define "admin/schema" }}
|
|
// Code generated by ent, DO NOT EDIT.
|
|
package admin
|
|
|
|
import (
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
type Enum struct {
|
|
Label, Value string
|
|
}
|
|
|
|
type FieldSchema struct {
|
|
Name string
|
|
Type field.Type
|
|
Optional bool
|
|
Immutable bool
|
|
Sensitive bool
|
|
Enums []Enum
|
|
}
|
|
|
|
|
|
{{- range $n := $.Nodes }}
|
|
const Name{{ $n.Name }} = "{{ $n.Name }}"
|
|
|
|
var fields{{ $n.Name }} = []*FieldSchema{
|
|
{{- range $f := $n.Fields }}
|
|
{
|
|
Name: "{{ $f.Name }}",
|
|
Type: field.{{ $f.Type.Type.ConstName }},
|
|
Optional: {{ $f.Optional }},
|
|
Immutable: {{ $f.Immutable }},
|
|
Sensitive: {{ $f.Sensitive }},
|
|
{{- if len $f.Enums }}
|
|
Enums: []Enum{
|
|
{{- range $e := $f.Enums }}
|
|
{
|
|
Label: "{{ $e.Label }}",
|
|
Value: "{{ $e.Value }}",
|
|
},
|
|
{{- end }}
|
|
},
|
|
{{- else }}
|
|
Enums: nil,
|
|
{{- end }}
|
|
},
|
|
{{- end }}
|
|
}
|
|
{{ end }}
|
|
|
|
{{ end }} |