zitadel/internal/query/instanceindex_enumer.go

83 lines
2.4 KiB
Go
Raw Normal View History

// Code generated by "enumer -type instanceIndex -linecomment"; DO NOT EDIT.
package query
import (
"fmt"
"strings"
)
const _instanceIndexName = "instanceIndexByIDinstanceIndexByHost"
var _instanceIndexIndex = [...]uint8{0, 0, 17, 36}
const _instanceIndexLowerName = "instanceindexbyidinstanceindexbyhost"
func (i instanceIndex) String() string {
if i < 0 || i >= instanceIndex(len(_instanceIndexIndex)-1) {
return fmt.Sprintf("instanceIndex(%d)", i)
}
return _instanceIndexName[_instanceIndexIndex[i]:_instanceIndexIndex[i+1]]
}
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
func _instanceIndexNoOp() {
var x [1]struct{}
_ = x[instanceIndexUnspecified-(0)]
_ = x[instanceIndexByID-(1)]
_ = x[instanceIndexByHost-(2)]
}
var _instanceIndexValues = []instanceIndex{instanceIndexUnspecified, instanceIndexByID, instanceIndexByHost}
var _instanceIndexNameToValueMap = map[string]instanceIndex{
_instanceIndexName[0:0]: instanceIndexUnspecified,
_instanceIndexLowerName[0:0]: instanceIndexUnspecified,
_instanceIndexName[0:17]: instanceIndexByID,
_instanceIndexLowerName[0:17]: instanceIndexByID,
_instanceIndexName[17:36]: instanceIndexByHost,
_instanceIndexLowerName[17:36]: instanceIndexByHost,
}
var _instanceIndexNames = []string{
_instanceIndexName[0:0],
_instanceIndexName[0:17],
_instanceIndexName[17:36],
}
// instanceIndexString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func instanceIndexString(s string) (instanceIndex, error) {
if val, ok := _instanceIndexNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _instanceIndexNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to instanceIndex values", s)
}
// instanceIndexValues returns all values of the enum
func instanceIndexValues() []instanceIndex {
return _instanceIndexValues
}
// instanceIndexStrings returns a slice of all String values of the enum
func instanceIndexStrings() []string {
strs := make([]string, len(_instanceIndexNames))
copy(strs, _instanceIndexNames)
return strs
}
// IsAinstanceIndex returns "true" if the value is listed in the enum definition. "false" otherwise
func (i instanceIndex) IsAinstanceIndex() bool {
for _, v := range _instanceIndexValues {
if i == v {
return true
}
}
return false
}