Documentation ¶
Overview ¶
Package generator provides types and functions for ent generator.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field struct { *ast.Field Default string // go code expression for the default value Form string // go code expression to parse form value (var name is v and returns (value, error)) SearchFieldTypeName string // go code expression for SearchDoc typename SearchFieldConverter string // go code expression to convert a original ent field tothe serach doc field Parser string // optional field to parse the string value (pkg.Func format) IsID bool IsTimestamp bool IsForm bool IsSearch bool ResetIfMissing bool // contains filtered or unexported fields }
Field is a type field
func (*Field) FieldNameSnakeCase ¶
FieldNameSnakeCase returns a snakecase of the field name.
func (*Field) GetDefaultExpr ¶
GetDefaultExpr returns the default value expression for the field.
func (*Field) GetFormExpr ¶
GetFormExpr returns a form field expression of the field.
func (*Field) GetSearchFieldTypeName ¶
GetSearchFieldType returns a type name string for search of the field.
type Struct ¶
type Struct struct { Package string Type string Kind string Instance string Fields []*Field Dependencies map[string]string IDField string TimestampField string IsSearchable bool }
Struct is a parsed result of struct to generate a code.
func (*Struct) AddDependency ¶
AddDependency adds a dependent package of the struct
func (*Struct) AddDependencyAs ¶
AddDependencyAs is like AddDependency with specifiyng the alias name.
Click to show internal directories.
Click to hide internal directories.