Help us shape the future of Go! Take the 2026 Go Developer Survey

enum

package
v0.9.47 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2024 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 EnumValues](names []string) E

Convert returns enum value from names

func FlagNames

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

FlagNames returns list of enum value names from flag value

func Flags

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

FlagsInt returns list of enum values from flag

func FlagsInt

func FlagsInt[E EnumNames](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 EnumValues](val string) E

Parse returns enum value from names

func SupportedNames

func SupportedNames[E EnumValues]() string

SupportedNames returns supported Enum values concatenated by ","

Types

type Enum

type Enum interface {
	~int32 | ~uint32
}

Enum interface for generic enum

type EnumNames

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

EnumNames interface for enum with names

type EnumValues

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

EnumValues interface for enum with values

Jump to

Keyboard shortcuts

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