enumer

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2023 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractValues

func ExtractValues(t *EnumType, f strcase.Format) error

func UnderlyingMaxIntLiteral

func UnderlyingMaxIntLiteral(k types.BasicKind) string

Types

type Cmd

type Cmd struct {
	Format strcase.Format `opts:"-f,--format, default:filtered-hyphen-case" desc:"default string representation format"`
	Files  []string       `opts:"args, name:file" desc:"restrict processing to specified files if any"`
}

func (*Cmd) Run

func (opts *Cmd) Run() error

type EnumType

type EnumType struct {
	Name         string
	Bitfield     bool
	CustomFormat bool
	Definitions  []EnumValueDef
	Position     token.Position

	UnderlyingMaxIntLiteral string
	Values                  []EnumValue
	// contains filtered or unexported fields
}

EnumType records the details about a defined enum type and its associated values

type EnumValue

type EnumValue struct {
	GoName string
	Value  interface{}

	Name           string
	AltNames       []string
	LowerCaseNames []string
}

EnumValue records all the details of an enumerated value necessary to produce the generated code output, including all alternate names for the definition of one value.

type EnumValueDef

type EnumValueDef struct {
	Name  string
	Value interface{}
	// contains filtered or unexported fields
}

EnumValueDef records the definition of an enumerated value

type PkgEnums

type PkgEnums struct {
	PkgName string
	PkgPath string
	Types   []EnumType
}

PkgEnums records all enumerated type found in one package

func ExtractEnums

func ExtractEnums(pkg *packages.Package) (*PkgEnums, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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