Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶ added in v1.0.2
Contains checks if the enum has a top-level field with the same type and value as the provided value. It does not recursively check nested structs. Returns true if a matching field is found, false otherwise.
func Keys ¶ added in v1.0.2
Keys returns a slice of the names of all top-level fields in the enum. It does not include fields from nested structs or unexported fields.
func New ¶
func New[T any]() T
New initializes an enum instance of type T, which must be a struct. Fields are populated based on their names (for strings), indices (for integers), or values specified in the "enum" tag. Supports nested structs, which are initialized recursively. Pointer fields are not allowed. Panics if T is not a struct, if unsupported field types (including pointers) are used, or if integer values overflow the target field type.
Types ¶
This section is empty.