gen

package
v0.0.0-...-e59e59a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConversionsTemplate

func ConversionsTemplate(enum Enum) ([]byte, error)

func ConversionsTestTemplate

func ConversionsTestTemplate(enum Enum) ([]byte, error)

func EvalValueString

func EvalValueString(expression string) (string, error)

func GenerateEnumHelpers

func GenerateEnumHelpers(pkgName string, enums []Enum, opts Options) ([]byte, error)

func GenerateEnumHelpersTests

func GenerateEnumHelpersTests(pkgName string, enums []Enum) ([]byte, error)

func NumericConversionsTemplate

func NumericConversionsTemplate(enum Enum) ([]byte, error)

func NumericConversionsTestTemplate

func NumericConversionsTestTemplate(enum Enum) ([]byte, error)

func ValuesFieldTemplate

func ValuesFieldTemplate(enum Enum) ([]byte, error)

func ValuesStructTemplate

func ValuesStructTemplate(enum Enum) ([]byte, error)

Types

type Enum

type Enum struct {
	Name     string
	BaseType string
	Values   []EnumValue
}

func ListEnumsTypesValues

func ListEnumsTypesValues(decls []ast.Decl) []Enum

func (Enum) ConstantBaseType

func (e Enum) ConstantBaseType() string

func (Enum) InputVarName

func (e Enum) InputVarName() string

func (Enum) NullValue

func (e Enum) NullValue() string

func (Enum) RandValue

func (e Enum) RandValue() string

func (Enum) TypeName

func (e Enum) TypeName() string

func (Enum) ValuesTypeName

func (e Enum) ValuesTypeName() string

func (Enum) VarName

func (e Enum) VarName() string

type EnumValue

type EnumValue struct {
	Name    string
	Value   string
	Comment string
}

func (EnumValue) EscapedValue

func (e EnumValue) EscapedValue() string

func (EnumValue) RawValue

func (e EnumValue) RawValue() string

type Options

type Options struct {
	GenerateValuesField  bool
	GenerateValuesStruct bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL