mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-18 05:52:51 +00:00
# Which Problems Are Solved As part of https://github.com/zitadel/zitadel/issues/9599 to push to move to a relational db table model, this is the migration of the settings # Additional Changes I had to add 2 non source code files `backend/v3/storage/database/events_testing/font.otf` and `backend/v3/storage/database/events_testing/picture.png`, these are used as part of the reduce tests, hence why they're sourced inside `backend/v3/storage/database/events_testing/settings_instance_test.go` - Closes https://github.com/zitadel/zitadel/issues/10207 --------- Co-authored-by: adlerhurst <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: Tim Möhlmann <[email protected]> Co-authored-by: Stefan Benz <[email protected]>
110 lines
2.7 KiB
Go
110 lines
2.7 KiB
Go
// Code generated by "enumer -type SettingState -transform snake -trimprefix SettingState -sql"; DO NOT EDIT.
|
|
|
|
package domain
|
|
|
|
import (
|
|
"database/sql/driver"
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
const _SettingStateName = "activepreview"
|
|
|
|
var _SettingStateIndex = [...]uint8{0, 6, 13}
|
|
|
|
const _SettingStateLowerName = "activepreview"
|
|
|
|
func (i SettingState) String() string {
|
|
if i < 0 || i >= SettingState(len(_SettingStateIndex)-1) {
|
|
return fmt.Sprintf("SettingState(%d)", i)
|
|
}
|
|
return _SettingStateName[_SettingStateIndex[i]:_SettingStateIndex[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 _SettingStateNoOp() {
|
|
var x [1]struct{}
|
|
_ = x[SettingStateActive-(0)]
|
|
_ = x[SettingStatePreview-(1)]
|
|
}
|
|
|
|
var _SettingStateValues = []SettingState{SettingStateActive, SettingStatePreview}
|
|
|
|
var _SettingStateNameToValueMap = map[string]SettingState{
|
|
_SettingStateName[0:6]: SettingStateActive,
|
|
_SettingStateLowerName[0:6]: SettingStateActive,
|
|
_SettingStateName[6:13]: SettingStatePreview,
|
|
_SettingStateLowerName[6:13]: SettingStatePreview,
|
|
}
|
|
|
|
var _SettingStateNames = []string{
|
|
_SettingStateName[0:6],
|
|
_SettingStateName[6:13],
|
|
}
|
|
|
|
// SettingStateString retrieves an enum value from the enum constants string name.
|
|
// Throws an error if the param is not part of the enum.
|
|
func SettingStateString(s string) (SettingState, error) {
|
|
if val, ok := _SettingStateNameToValueMap[s]; ok {
|
|
return val, nil
|
|
}
|
|
|
|
if val, ok := _SettingStateNameToValueMap[strings.ToLower(s)]; ok {
|
|
return val, nil
|
|
}
|
|
return 0, fmt.Errorf("%s does not belong to SettingState values", s)
|
|
}
|
|
|
|
// SettingStateValues returns all values of the enum
|
|
func SettingStateValues() []SettingState {
|
|
return _SettingStateValues
|
|
}
|
|
|
|
// SettingStateStrings returns a slice of all String values of the enum
|
|
func SettingStateStrings() []string {
|
|
strs := make([]string, len(_SettingStateNames))
|
|
copy(strs, _SettingStateNames)
|
|
return strs
|
|
}
|
|
|
|
// IsASettingState returns "true" if the value is listed in the enum definition. "false" otherwise
|
|
func (i SettingState) IsASettingState() bool {
|
|
for _, v := range _SettingStateValues {
|
|
if i == v {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (i SettingState) Value() (driver.Value, error) {
|
|
return i.String(), nil
|
|
}
|
|
|
|
func (i *SettingState) 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 SettingState: %[1]T(%[1]v)", value)
|
|
}
|
|
|
|
val, err := SettingStateString(str)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*i = val
|
|
return nil
|
|
}
|