Documentation ¶
Index ¶
- Constants
- func PtrStr(x string) *string
- type Branching
- type DeriveFuncMatchGenerator
- type FunctionMatchGenerator
- type GenerateOption
- type Generator
- type Helpers
- type InferredDeriveFuncMatchInfo
- type InferredInfo
- func (f *InferredInfo) ForVariantType(name string, types []string) map[string][]Branching
- func (f *InferredInfo) PossibleUnionTypes() []string
- func (f *InferredInfo) PossibleVariantsTypes(unionName string) []string
- func (f *InferredInfo) RetrieveStruct() []*shape.StructLike
- func (f *InferredInfo) RetrieveUnions() []*shape.UnionLike
- func (f *InferredInfo) StructShapeWith(name string) *shape.StructLike
- func (f *InferredInfo) Visit(n ast.Node) ast.Visitor
- type MatchBuilder
- type MatchSpec
- type ReducerBreadthFirstGenerator
- type ReducerDefaultReductionGenerator
- type ReducerDepthFirstGenerator
- type SchemaGenerator
- type VisitorDefaultGenerator
- type VisitorGenerator
Constants ¶
View Source
const ( Program = "mkunion" Header = `// Code generated by ` + Program + `. DO NOT EDIT.` )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DeriveFuncMatchGenerator ¶ added in v1.16.0
func (*DeriveFuncMatchGenerator) Generate ¶ added in v1.16.0
func (g *DeriveFuncMatchGenerator) Generate() ([]byte, error)
type FunctionMatchGenerator ¶ added in v1.4.0
func (*FunctionMatchGenerator) Generate ¶ added in v1.4.0
func (t *FunctionMatchGenerator) Generate() ([]byte, error)
type GenerateOption ¶ added in v1.19.0
type GenerateOption func(o *generatorOptions)
func WithBufferedImports ¶ added in v1.19.0
func WithBufferedImports() GenerateOption
func WithPackageName ¶ added in v1.19.0
func WithPackageName(name string) GenerateOption
type Helpers ¶ added in v1.19.0
type Helpers struct {
// contains filtered or unexported fields
}
func NewHelper ¶ added in v1.19.0
func NewHelper(fs ...GenerateOption) *Helpers
func (*Helpers) RenderBufferedHeader ¶ added in v1.19.0
func (*Helpers) RenderBufferedImport ¶ added in v1.19.0
func (*Helpers) RenderHeader ¶ added in v1.19.0
func (*Helpers) RenderImport ¶ added in v1.19.0
type InferredDeriveFuncMatchInfo ¶ added in v1.16.0
type InferredDeriveFuncMatchInfo struct { PackageName string // contains filtered or unexported fields }
func InferDeriveFuncMatchFromFile ¶ added in v1.16.0
func InferDeriveFuncMatchFromFile(filename string) (*InferredDeriveFuncMatchInfo, error)
type InferredInfo ¶
type InferredInfo struct { PackageName string PkgImportName string Types map[string]map[string][]Branching // contains filtered or unexported fields }
func InferFromFile ¶
func InferFromFile(filename string) (*InferredInfo, error)
func (*InferredInfo) ForVariantType ¶
func (f *InferredInfo) ForVariantType(name string, types []string) map[string][]Branching
func (*InferredInfo) PossibleUnionTypes ¶ added in v1.19.0
func (f *InferredInfo) PossibleUnionTypes() []string
func (*InferredInfo) PossibleVariantsTypes ¶ added in v1.6.0
func (f *InferredInfo) PossibleVariantsTypes(unionName string) []string
func (*InferredInfo) RetrieveStruct ¶ added in v1.19.0
func (f *InferredInfo) RetrieveStruct() []*shape.StructLike
func (*InferredInfo) RetrieveUnions ¶ added in v1.19.0
func (f *InferredInfo) RetrieveUnions() []*shape.UnionLike
func (*InferredInfo) StructShapeWith ¶ added in v1.19.0
func (f *InferredInfo) StructShapeWith(name string) *shape.StructLike
type MatchBuilder ¶ added in v1.16.0
type MatchBuilder struct {
// contains filtered or unexported fields
}
func NewMatchBuilder ¶ added in v1.16.0
func NewMatchBuilder() *MatchBuilder
func (*MatchBuilder) AddCase ¶ added in v1.16.0
func (b *MatchBuilder) AddCase(name string, inputs ...string) error
func (*MatchBuilder) Build ¶ added in v1.16.0
func (b *MatchBuilder) Build() (*MatchSpec, error)
func (*MatchBuilder) SetInputs ¶ added in v1.16.0
func (b *MatchBuilder) SetInputs(types ...string) error
func (*MatchBuilder) SetName ¶ added in v1.16.0
func (b *MatchBuilder) SetName(name string) error
type ReducerBreadthFirstGenerator ¶ added in v1.2.0
type ReducerBreadthFirstGenerator struct { Name variantName Types []typeName Branches map[typeName][]Branching Helper *Helpers // contains filtered or unexported fields }
func NewReducerBreadthFirstGenerator ¶ added in v1.19.0
func NewReducerBreadthFirstGenerator( name variantName, types []typeName, branches map[typeName][]Branching, helper *Helpers, ) *ReducerBreadthFirstGenerator
func (*ReducerBreadthFirstGenerator) Generate ¶ added in v1.2.0
func (t *ReducerBreadthFirstGenerator) Generate() ([]byte, error)
type ReducerDefaultReductionGenerator ¶ added in v1.2.0
type ReducerDefaultReductionGenerator struct { Name variantName Types []typeName Helper *Helpers // contains filtered or unexported fields }
func NewReducerDefaultReductionGenerator ¶ added in v1.19.0
func NewReducerDefaultReductionGenerator( name variantName, types []typeName, helper *Helpers, ) *ReducerDefaultReductionGenerator
func (*ReducerDefaultReductionGenerator) Generate ¶ added in v1.2.0
func (t *ReducerDefaultReductionGenerator) Generate() ([]byte, error)
type ReducerDepthFirstGenerator ¶ added in v1.2.0
type ReducerDepthFirstGenerator struct { Name variantName Types []typeName Branches map[typeName][]Branching Helper *Helpers // contains filtered or unexported fields }
func NewReducerDepthFirstGenerator ¶ added in v1.19.0
func NewReducerDepthFirstGenerator( name variantName, types []typeName, branches map[typeName][]Branching, helper *Helpers, ) *ReducerDepthFirstGenerator
func (*ReducerDepthFirstGenerator) Generate ¶ added in v1.2.0
func (t *ReducerDepthFirstGenerator) Generate() ([]byte, error)
type SchemaGenerator ¶ added in v1.7.2
type SchemaGenerator struct { Types []string Name string Helper *Helpers // contains filtered or unexported fields }
func NewSchemaGenerator ¶ added in v1.19.0
func NewSchemaGenerator(name string, types []string, helper *Helpers) *SchemaGenerator
func (*SchemaGenerator) Generate ¶ added in v1.7.2
func (g *SchemaGenerator) Generate() ([]byte, error)
type VisitorDefaultGenerator ¶
type VisitorDefaultGenerator struct { Name string Types []string Helper *Helpers // contains filtered or unexported fields }
func NewVisitorDefaultGenerator ¶ added in v1.19.0
func NewVisitorDefaultGenerator(name string, types []string, helper *Helpers) *VisitorDefaultGenerator
func (*VisitorDefaultGenerator) Generate ¶
func (g *VisitorDefaultGenerator) Generate() ([]byte, error)
type VisitorGenerator ¶
type VisitorGenerator struct { Types []string Name string Helper *Helpers // contains filtered or unexported fields }
func NewVisitorGenerator ¶ added in v1.19.0
func NewVisitorGenerator(name string, types []string, helper *Helpers) *VisitorGenerator
func (*VisitorGenerator) Generate ¶
func (g *VisitorGenerator) Generate() ([]byte, error)
Source Files ¶
- derive_func_match_generator.go
- infer_defaults.go
- infer_derive_func_builder.go
- infer_derive_func_match.go
- match_generator.go
- reducer_breadth_first_generator.go
- reducer_default_reduction_generator.go
- reducer_depth_first_generator.go
- schema_generator.go
- visitor_default_generator.go
- visitor_generator.go
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
ast
Package ast defines the AST for simple language AST can be created either by parser or by hand, it's up to implementer to decide how to create AST This package provides few examples of AST creation mostly by parsing JSON - ast_sugar.go - ast_human_friendly.go - ast_description_of_best_result Much more advance parser is also possible, but it's not implemented here
|
Package ast defines the AST for simple language AST can be created either by parser or by hand, it's up to implementer to decide how to create AST This package provides few examples of AST creation mostly by parsing JSON - ast_sugar.go - ast_human_friendly.go - ast_description_of_best_result Much more advance parser is also possible, but it's not implemented here |
Code generated by mkfunc.
|
Code generated by mkfunc. |
x
|
|
schema
Code generated by mkunion.
|
Code generated by mkunion. |
shape
Code generated by mkunion.
|
Code generated by mkunion. |
Click to show internal directories.
Click to hide internal directories.