enummagic

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllDefined

func AllDefined[T protoreflect.Enum](_ ...T) []T

AllDefined returns all defined values of the enum type. It includes the zero (_UNSPECIFIED) value.

func AllSpecified

func AllSpecified[T protoreflect.Enum](_ ...T) []T

AllSpecified returns all specified values of the enum type. It excludes the zero (_UNSPECIFIED) value.

func IsDefined

func IsDefined[T protoreflect.Enum](enum T) bool

IsDefined returns true if the enum value is defined in the enum type.

func IsSpecified

func IsSpecified[T protoreflect.Enum](enum T) bool

IsSpecified returns true if the enum value is defined and not the zero value.

func ShortName

func ShortName[T protoreflect.Enum](enum T) string

ShortName returns the short name in the lower case of the enum value. For example, "TEST_ENUM_TYPE_FOO" -> "foo".

Types

This section is empty.

Jump to

Keyboard shortcuts

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