Documentation
¶
Overview ¶
Package loader loads generator information from an external file.
Index ¶
- func CountFields(fields []*models.Field) int
- func DefineFieldsByFrom(from *From, toType *models.Type, fromType *models.Type) ([]*models.Field, []*models.Field)
- func LoadYML(filepath string) (*models.Generator, error)
- func PrintFieldGraph(fields []*models.Field, tabs string)
- func PrintFieldRelation(toFields []*models.Field, fromFields []*models.Field)
- func PrintFieldTree(typename string, fields []*models.Field, tabs string)
- func PrintFunctionFields(function models.Function)
- type AST
- type Field
- type From
- type Function
- type Parser
- type To
- type YML
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountFields ¶
CountFields returns the number of fields in a field slice.
func DefineFieldsByFrom ¶
func DefineFieldsByFrom(from *From, toType *models.Type, fromType *models.Type) ([]*models.Field, []*models.Field)
DefineFieldsByFrom defines fields for a to-type and from-type based on a YML from. Used when the user specifies the fields to match in the loader.
func PrintFieldGraph ¶
PrintFieldGraph prints a list of fields with the related fields.
func PrintFieldRelation ¶
PrintFieldRelation prints the relationship between to and from fields.
func PrintFieldTree ¶
PrintFieldTree prints a tree of fields for a given type to standard output.
func PrintFunctionFields ¶
PrintFunctionFields prints all of a functions fields to standard output.
Types ¶
type AST ¶
type AST struct {
Depth int // The current depth level of the ASTSearcher.
MaxDepth int // The maximum depth of the ASTSearcher.
// contains filtered or unexported fields
}
AST uses Abstract Syntax Tree analysis to find fields.
type Field ¶
type Field struct {
To string `yaml:"to"`
Convert string `yaml:"convert"`
Deepcopy string `yaml:"deepcopy"`
Options map[string]interface{} `yaml:"options"`
}
Field represents the field properties of the YML file.
type From ¶
type From struct {
Package string `yaml:"package"`
Import string `yaml:"import"`
Fields map[string]Field `yaml:"fields"`
Pointer bool `yaml:"pointer"`
Depth int `yaml:"depth"`
Deepcopy string `yaml:"deepcopy"`
Options map[string]interface{} `yaml:"options"`
}
From represents from-type properties in the YML file.
type Function ¶
type Function struct {
To map[string]To `yaml:"to"`
From map[string]From `yaml:"from"`
Options map[string]interface{} `yaml:"options"`
}
Function represents function properties of the YML file.
type Parser ¶
type Parser struct {
YML YML // The YML that is parsed.
AST AST // The Abstract Syntax Tree object used during matching.
Generator models.Generator // The generator that information is parsed to.
}
Parser represents a YML parser that loads properties into the program models.