Documentation ¶
Index ¶
- func Mapify(e Enum) (ret string, err error)
- func Stringify(e Enum) (ret string, err error)
- func Unmapify(e Enum, lowercase bool) (ret string, err error)
- type Enum
- type EnumValue
- type Generator
- func (g *Generator) Generate(f *ast.File) ([]byte, error)
- func (g *Generator) GenerateFromFile(inputFile string) ([]byte, error)
- func (g *Generator) WithFlag() *Generator
- func (g *Generator) WithLowercaseVariant() *Generator
- func (g *Generator) WithMarshal() *Generator
- func (g *Generator) WithNoPrefix() *Generator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator is responsible for generating validation files for the given in a go source file.
func NewGenerator ¶
func NewGenerator() *Generator
NewGenerator is a constructor method for creating a new Generator with default templates loaded.
func (*Generator) Generate ¶
Generate does the heavy lifting for the code generation starting from the parsed AST file.
func (*Generator) GenerateFromFile ¶
GenerateFromFile is responsible for orchestrating the Code generation. It results in a byte array that can be written to any file desired. It has already had goimports run on the code before being returned.
func (*Generator) WithLowercaseVariant ¶
WithLowercaseVariant is used to change the enum const values generated to not have the enum on them.
func (*Generator) WithMarshal ¶
WithMarshal is used to add marshalling to the enum
func (*Generator) WithNoPrefix ¶
WithNoPrefix is used to change the enum const values generated to not have the enum on them.