enumz

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustGenerateEnums

func MustGenerateEnums(outDirPath string, wipe bool, packageName string, specs []*EnumSpec)

MustGenerateEnums generates enums from the given specs.

Types

type EnumSpec

type EnumSpec struct {
	EnumNamePlural     string
	EnumNameSingular   string
	EnumNameInComments string
	FileName           string
	Values             []*EnumSpecValue
}

EnumSpec describes the specification for a generated enum.

func ProcessSimpleEnumSpecs

func ProcessSimpleEnumSpecs(simpleSpecs map[string][]string) []*EnumSpec

ProcessSimpleEnumSpecs implements a standard, simplified specification for enum specs.

- Each key in the map should be an upper camel, plural enum name. - Each entry in the values slice should be an upper camel, singular value name.

type EnumSpecValue

type EnumSpecValue struct {
	Name  string
	Value string
	Label string
}

EnumSpecValue describes the specification for a generated enum value.

Jump to

Keyboard shortcuts

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