enum

package
v0.85.0-pre.12 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnyEnum

type AnyEnum interface {
	Struct() any
	// contains filtered or unexported methods
}

type Enum

type Enum[V Value, N Native, S any] struct {
	// contains filtered or unexported fields
}

S must be a struct type with fields of type V. The field names will be used as the enum keys, and the field values will be used as the enum values.

func New

func New[V Value, N Native, S any](enum S) Enum[V, N, S]

S must be a struct type with fields of type V. The field names will be used as the enum keys, and the field values will be used as the enum values.

func (Enum[V, N, S]) Get

func (e Enum[V, N, S]) Get() S

func (Enum[V, N, S]) NativeValues

func (e Enum[V, N, S]) NativeValues() []N

func (Enum[V, N, S]) Parse

func (e Enum[V, N, S]) Parse(value N) (V, bool)

func (Enum[V, N, S]) Struct

func (e Enum[V, N, S]) Struct() any

func (Enum[V, N, S]) Values

func (e Enum[V, N, S]) Values() []V

type Native

type Native interface {
	string | int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64
}

type Value

type Value interface {
	~string | ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64
}

Jump to

Keyboard shortcuts

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