Documentation ¶
Index ¶
- func Mapify(e Enum) (ret string, err error)
- func Namify(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) WithCaseInsensitiveParse() *Generator
- func (g *Generator) WithFlag() *Generator
- func (g *Generator) WithLowercaseVariant() *Generator
- func (g *Generator) WithMarshal() *Generator
- func (g *Generator) WithNames() *Generator
- func (g *Generator) WithNoPrefix() *Generator
- func (g *Generator) WithPrefix(prefix string) *Generator
- func (g *Generator) WithPtr() *Generator
- func (g *Generator) WithSQLDriver() *Generator
- func (g *Generator) WithSQLNullInt() *Generator
- func (g *Generator) WithSQLNullStr() *Generator
- func (g *Generator) WithTemplates(filenames ...string) *Generator
- func (g *Generator) WithoutSnakeToCamel() *Generator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Namify ¶ added in v0.1.4
Namify returns a slice that is all of the possible names for an enum in a slice
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) WithCaseInsensitiveParse ¶ added in v0.3.4
WithLowercaseVariant is used to change the enum const values generated to not have the enum on them.
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.
func (*Generator) WithPrefix ¶ added in v0.3.4
WithPrefix is used to add a custom prefix to the enum constants
func (*Generator) WithPtr ¶ added in v0.3.4
WithPtr adds a way to get a pointer value straight from the const value.
func (*Generator) WithSQLDriver ¶ added in v0.1.5
WithSQLDriver is used to add marshalling to the enum
func (*Generator) WithSQLNullInt ¶ added in v0.3.4
WithSQLNullInt is used to add a null int option for SQL interactions.
func (*Generator) WithSQLNullStr ¶ added in v0.3.4
WithSQLNullStr is used to add a null string option for SQL interactions.
func (*Generator) WithTemplates ¶ added in v0.3.4
WithTemplates is used to provide the filenames of additional templates.
func (*Generator) WithoutSnakeToCamel ¶ added in v0.3.4
WithoutSnakeToCamel is used to add flag methods to the enum