mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-18 13:52:51 +00:00
110 lines
2.5 KiB
Go
110 lines
2.5 KiB
Go
// Code generated by "enumer -type IDPState -transform lower -trimprefix IDPState -sql"; DO NOT EDIT.
|
|
|
|
package domain
|
|
|
|
import (
|
|
"database/sql/driver"
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
const _IDPStateName = "activeinactive"
|
|
|
|
var _IDPStateIndex = [...]uint8{0, 6, 14}
|
|
|
|
const _IDPStateLowerName = "activeinactive"
|
|
|
|
func (i IDPState) String() string {
|
|
if i >= IDPState(len(_IDPStateIndex)-1) {
|
|
return fmt.Sprintf("IDPState(%d)", i)
|
|
}
|
|
return _IDPStateName[_IDPStateIndex[i]:_IDPStateIndex[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 _IDPStateNoOp() {
|
|
var x [1]struct{}
|
|
_ = x[IDPStateActive-(0)]
|
|
_ = x[IDPStateInactive-(1)]
|
|
}
|
|
|
|
var _IDPStateValues = []IDPState{IDPStateActive, IDPStateInactive}
|
|
|
|
var _IDPStateNameToValueMap = map[string]IDPState{
|
|
_IDPStateName[0:6]: IDPStateActive,
|
|
_IDPStateLowerName[0:6]: IDPStateActive,
|
|
_IDPStateName[6:14]: IDPStateInactive,
|
|
_IDPStateLowerName[6:14]: IDPStateInactive,
|
|
}
|
|
|
|
var _IDPStateNames = []string{
|
|
_IDPStateName[0:6],
|
|
_IDPStateName[6:14],
|
|
}
|
|
|
|
// IDPStateString retrieves an enum value from the enum constants string name.
|
|
// Throws an error if the param is not part of the enum.
|
|
func IDPStateString(s string) (IDPState, error) {
|
|
if val, ok := _IDPStateNameToValueMap[s]; ok {
|
|
return val, nil
|
|
}
|
|
|
|
if val, ok := _IDPStateNameToValueMap[strings.ToLower(s)]; ok {
|
|
return val, nil
|
|
}
|
|
return 0, fmt.Errorf("%s does not belong to IDPState values", s)
|
|
}
|
|
|
|
// IDPStateValues returns all values of the enum
|
|
func IDPStateValues() []IDPState {
|
|
return _IDPStateValues
|
|
}
|
|
|
|
// IDPStateStrings returns a slice of all String values of the enum
|
|
func IDPStateStrings() []string {
|
|
strs := make([]string, len(_IDPStateNames))
|
|
copy(strs, _IDPStateNames)
|
|
return strs
|
|
}
|
|
|
|
// IsAIDPState returns "true" if the value is listed in the enum definition. "false" otherwise
|
|
func (i IDPState) IsAIDPState() bool {
|
|
for _, v := range _IDPStateValues {
|
|
if i == v {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (i IDPState) Value() (driver.Value, error) {
|
|
return i.String(), nil
|
|
}
|
|
|
|
func (i *IDPState) Scan(value interface{}) error {
|
|
if value == nil {
|
|
return nil
|
|
}
|
|
|
|
var str string
|
|
switch v := value.(type) {
|
|
case []byte:
|
|
str = string(v)
|
|
case string:
|
|
str = v
|
|
case fmt.Stringer:
|
|
str = v.String()
|
|
default:
|
|
return fmt.Errorf("invalid value of IDPState: %[1]T(%[1]v)", value)
|
|
}
|
|
|
|
val, err := IDPStateString(str)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*i = val
|
|
return nil
|
|
}
|