Documentation ¶
Index ¶
- type DuplicateKeyError
- type DuplicateValueError
- type EnumMap
- func (em *EnumMap) Add(k string, v int) error
- func (em *EnumMap) AsInt() map[string]int
- func (em *EnumMap) ForEach(f func(k int, v string))
- func (em *EnumMap) ForEachSorted(f func(k int, v string))
- func (em *EnumMap) Int(s string) (int, error)
- func (em *EnumMap) Keys() []string
- func (em *EnumMap) String(i int) (string, error)
- func (em *EnumMap) StringDefault(i int, dflt string) string
- func (em *EnumMap) UnMarshal(arg []byte) (int, error)
- type IntKeyNotFoundError
- type NonLowercaseKeyError
- type StringKeyNotFoundError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DuplicateKeyError ¶
type DuplicateKeyError string
DuplicateKeyError Duplicate key
func (DuplicateKeyError) Error ¶
func (dk DuplicateKeyError) Error() string
type DuplicateValueError ¶
type DuplicateValueError int
DuplicateValueError Duplicate value
func (DuplicateValueError) Error ¶
func (dv DuplicateValueError) Error() string
type EnumMap ¶
type EnumMap struct {
// contains filtered or unexported fields
}
EnumMap struct with internal maps containing string and int representations
func NewEnumMap ¶
NewEnumMap new enum map from map. Returns error if duplicate values or non-lowercase keys. NewEnumMapOrPanic is preferable for global EnumMap-variables.
func NewEnumMapOrPanic ¶ added in v0.5.7
NewEnumMapOrPanic is intended for assignment to global EnumMap-variables, within global scope or init()-function. When used for global variables NewEnumMapOrPanic fails early, which will be detected by any tests in the same package (even with an empty test file). NewEnumMap is preferable in other cases.
func (*EnumMap) ForEachSorted ¶
ForEachSorted execute function for each enum with strict ordering this is somewhat heavier than using regular ForEach
func (*EnumMap) StringDefault ¶
StringDefault Get string representation of enum or default value
type IntKeyNotFoundError ¶
type IntKeyNotFoundError int
IntKeyNotFoundError Key(int) not found in enum map
func (IntKeyNotFoundError) Error ¶
func (ik IntKeyNotFoundError) Error() string
type NonLowercaseKeyError ¶
type NonLowercaseKeyError string
NonLowercaseKeyError Key contains non-lowercase character
func (NonLowercaseKeyError) Error ¶
func (nlk NonLowercaseKeyError) Error() string
type StringKeyNotFoundError ¶
type StringKeyNotFoundError string
StringKeyNotFoundError Key(string) not found in enum map
func (StringKeyNotFoundError) Error ¶
func (sk StringKeyNotFoundError) Error() string