draft enums

This commit is contained in:
5684185+vsariola@users.noreply.github.com
2026-01-27 23:26:13 +02:00
parent ca4b87d43d
commit f88986dc64

View File

@ -152,6 +152,25 @@ func (v Int) Value() int {
return v.value.Value()
}
// Enum
type (
Enum struct {
value EnumValue
Int
}
EnumValue interface {
Option(value int) string
IntValue
}
)
func MakeEnum(e EnumValue) Enum { return Enum{value: e, Int: Int{e}} }
func (e Enum) String() string { return e.value.Option(e.Value()) }
func (e Enum) Option(v int) string { return e.value.Option(v) }
// String
type (