// Code generated by "enumer -type=Status -linecomment -text"; DO NOT EDIT. package nethelpers import ( "fmt" ) const _StatusName = "addressesconnectivityhostnameetcfiles" var _StatusIndex = [...]uint8{0, 9, 21, 29, 37} func (i Status) String() string { i -= 1 if i < 0 || i >= Status(len(_StatusIndex)-1) { return fmt.Sprintf("Status(%d)", i+1) } return _StatusName[_StatusIndex[i]:_StatusIndex[i+1]] } var _StatusValues = []Status{1, 2, 3, 4} var _StatusNameToValueMap = map[string]Status{ _StatusName[0:9]: 1, _StatusName[9:21]: 2, _StatusName[21:29]: 3, _StatusName[29:37]: 4, } // StatusString retrieves an enum value from the enum constants string name. // Throws an error if the param is not part of the enum. func StatusString(s string) (Status, error) { if val, ok := _StatusNameToValueMap[s]; ok { return val, nil } return 0, fmt.Errorf("%s does not belong to Status values", s) } // StatusValues returns all values of the enum func StatusValues() []Status { return _StatusValues } // IsAStatus returns "true" if the value is listed in the enum definition. "false" otherwise func (i Status) IsAStatus() bool { for _, v := range _StatusValues { if i == v { return true } } return false } // MarshalText implements the encoding.TextMarshaler interface for Status func (i Status) MarshalText() ([]byte, error) { return []byte(i.String()), nil } // UnmarshalText implements the encoding.TextUnmarshaler interface for Status func (i *Status) UnmarshalText(text []byte) error { var err error *i, err = StatusString(string(text)) return err }