enum

package
v0.12.53 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert[E Values](names []string) E

Convert returns enum value from names

func FlagNames

func FlagNames[E Names](val E) []string

FlagNames returns list of enum value names from flag value

func Flags

func Flags[E Names](val E) []E

FlagsInt returns list of enum values from flag

func FlagsInt

func FlagsInt[E Names](val E) []int32

FlagsInt returns list of enum values from flag

func NamesHelpString

func NamesHelpString(vals map[string]int32) string

NamesHelpString returns supported Enum values concatenated by ","

func Parse

func Parse[E Values](val string) E

Parse returns enum value from names

func SupportedNames

func SupportedNames[E Values]() string

SupportedNames returns supported Enum values concatenated by ","

Types

type Enum

type Enum interface {
	~int32 | ~uint32
}

Enum interface for generic enum

type Names added in v0.9.48

type Names interface {
	Enum
	NamesMap() map[int32]string
}

Names interface for enum with names

type Values added in v0.9.48

type Values interface {
	Enum
	ValuesMap() map[string]int32
}

Values interface for enum with values

Jump to

Keyboard shortcuts

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