Files
zitadel/backend/v3/storage/database/operators_enumer.go
T
Livio SpringandGitHub 4e6f68c511 feat(relational): implement session repository (#11109)
# Which Problems Are Solved

As part of going to a relation storage model, we need to implement the
repository for handling sessions and their events.

# How the Problems Are Solved

- Adds a migration step to create the necessary tables and types in the
database.
- Adds the repository implementation for sessions.
- Implements a projection handler for session events to handle the
events written by the old command handlers.
- Updates the `Session` type and `SessionRepository` interface:
  - added `CreatorID`
  - Adjusted `Delete` method to return amount of affected columns
  - Removed sub-repository clumns from the main interface
- Added `CreatorIDCondition`, `ExpirationCondition`, `ExistsFactor` and
`ExistsMetadata`
  - Removed `SetUserAgent`
- Methods of `SessionFactor` and `SessionChallenge` have been made
public
- fixed enumer on `SessionFactorType`
- Adds a `JSON` type to the repository package to easy can JSON columns,
resp. jsonb object inside a property of a `JSONArray` object.
- Adds a `NoChange` interface, which can be implemented to signal that a
`Change` interface implementation is not writing any changes to the
statement builder, e.g. `CTEChange`

# Additional Changes

- Fixes the operators enums. `TextOperations` had wrong comments and
`NumberOperations` additionally also had from comparisons.
- Fixes downgrade of migration step 008.

# Additional Context

- closes https://github.com/zitadel/zitadel/issues/10212
2026-01-06 08:08:11 +01:00

270 lines
9.2 KiB
Go

// Code generated by "enumer -type NumberOperation,TextOperation,BytesOperation -linecomment -output ./operators_enumer.go"; DO NOT EDIT.
package database
import (
"fmt"
"strings"
)
const _NumberOperationName = "=<><<=>>="
var _NumberOperationIndex = [...]uint8{0, 1, 3, 4, 6, 7, 9}
const _NumberOperationLowerName = "=<><<=>>="
func (i NumberOperation) String() string {
i -= 1
if i >= NumberOperation(len(_NumberOperationIndex)-1) {
return fmt.Sprintf("NumberOperation(%d)", i+1)
}
return _NumberOperationName[_NumberOperationIndex[i]:_NumberOperationIndex[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 _NumberOperationNoOp() {
var x [1]struct{}
_ = x[NumberOperationEqual-(1)]
_ = x[NumberOperationNotEqual-(2)]
_ = x[NumberOperationLessThan-(3)]
_ = x[NumberOperationLessThanOrEqual-(4)]
_ = x[NumberOperationGreaterThan-(5)]
_ = x[NumberOperationGreaterThanOrEqual-(6)]
}
var _NumberOperationValues = []NumberOperation{NumberOperationEqual, NumberOperationNotEqual, NumberOperationLessThan, NumberOperationLessThanOrEqual, NumberOperationGreaterThan, NumberOperationGreaterThanOrEqual}
var _NumberOperationNameToValueMap = map[string]NumberOperation{
_NumberOperationName[0:1]: NumberOperationEqual,
_NumberOperationLowerName[0:1]: NumberOperationEqual,
_NumberOperationName[1:3]: NumberOperationNotEqual,
_NumberOperationLowerName[1:3]: NumberOperationNotEqual,
_NumberOperationName[3:4]: NumberOperationLessThan,
_NumberOperationLowerName[3:4]: NumberOperationLessThan,
_NumberOperationName[4:6]: NumberOperationLessThanOrEqual,
_NumberOperationLowerName[4:6]: NumberOperationLessThanOrEqual,
_NumberOperationName[6:7]: NumberOperationGreaterThan,
_NumberOperationLowerName[6:7]: NumberOperationGreaterThan,
_NumberOperationName[7:9]: NumberOperationGreaterThanOrEqual,
_NumberOperationLowerName[7:9]: NumberOperationGreaterThanOrEqual,
}
var _NumberOperationNames = []string{
_NumberOperationName[0:1],
_NumberOperationName[1:3],
_NumberOperationName[3:4],
_NumberOperationName[4:6],
_NumberOperationName[6:7],
_NumberOperationName[7:9],
}
// NumberOperationString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func NumberOperationString(s string) (NumberOperation, error) {
if val, ok := _NumberOperationNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _NumberOperationNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to NumberOperation values", s)
}
// NumberOperationValues returns all values of the enum
func NumberOperationValues() []NumberOperation {
return _NumberOperationValues
}
// NumberOperationStrings returns a slice of all String values of the enum
func NumberOperationStrings() []string {
strs := make([]string, len(_NumberOperationNames))
copy(strs, _NumberOperationNames)
return strs
}
// IsANumberOperation returns "true" if the value is listed in the enum definition. "false" otherwise
func (i NumberOperation) IsANumberOperation() bool {
for _, v := range _NumberOperationValues {
if i == v {
return true
}
}
return false
}
const _TextOperationName = "=<>LIKELIKELIKELIKELIKELIKE=<>"
var _TextOperationIndex = [...]uint8{0, 1, 3, 7, 11, 15, 19, 23, 27, 28, 30}
const _TextOperationLowerName = "=<>likelikelikelikelikelike=<>"
func (i TextOperation) String() string {
i -= 1
if i >= TextOperation(len(_TextOperationIndex)-1) {
return fmt.Sprintf("TextOperation(%d)", i+1)
}
return _TextOperationName[_TextOperationIndex[i]:_TextOperationIndex[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 _TextOperationNoOp() {
var x [1]struct{}
_ = x[TextOperationEqual-(1)]
_ = x[TextOperationNotEqual-(2)]
_ = x[TextOperationStartsWith-(3)]
_ = x[TextOperationContains-(4)]
_ = x[TextOperationEndsWith-(5)]
_ = x[TextOperationContainsIgnoreCase-(6)]
_ = x[TextOperationEndsWithIgnoreCase-(7)]
_ = x[TextOperationStartsWithIgnoreCase-(8)]
_ = x[TextOperationEqualIgnoreCase-(9)]
_ = x[TextOperationNotEqualIgnoreCase-(10)]
}
var _TextOperationValues = []TextOperation{TextOperationEqual, TextOperationNotEqual, TextOperationStartsWith, TextOperationContains, TextOperationEndsWith, TextOperationContainsIgnoreCase, TextOperationEndsWithIgnoreCase, TextOperationStartsWithIgnoreCase, TextOperationEqualIgnoreCase, TextOperationNotEqualIgnoreCase}
var _TextOperationNameToValueMap = map[string]TextOperation{
_TextOperationName[0:1]: TextOperationEqual,
_TextOperationLowerName[0:1]: TextOperationEqual,
_TextOperationName[1:3]: TextOperationNotEqual,
_TextOperationLowerName[1:3]: TextOperationNotEqual,
_TextOperationName[3:7]: TextOperationStartsWith,
_TextOperationLowerName[3:7]: TextOperationStartsWith,
_TextOperationName[7:11]: TextOperationContains,
_TextOperationLowerName[7:11]: TextOperationContains,
_TextOperationName[11:15]: TextOperationEndsWith,
_TextOperationLowerName[11:15]: TextOperationEndsWith,
_TextOperationName[15:19]: TextOperationContainsIgnoreCase,
_TextOperationLowerName[15:19]: TextOperationContainsIgnoreCase,
_TextOperationName[19:23]: TextOperationEndsWithIgnoreCase,
_TextOperationLowerName[19:23]: TextOperationEndsWithIgnoreCase,
_TextOperationName[23:27]: TextOperationStartsWithIgnoreCase,
_TextOperationLowerName[23:27]: TextOperationStartsWithIgnoreCase,
_TextOperationName[27:28]: TextOperationEqualIgnoreCase,
_TextOperationLowerName[27:28]: TextOperationEqualIgnoreCase,
_TextOperationName[28:30]: TextOperationNotEqualIgnoreCase,
_TextOperationLowerName[28:30]: TextOperationNotEqualIgnoreCase,
}
var _TextOperationNames = []string{
_TextOperationName[0:1],
_TextOperationName[1:3],
_TextOperationName[3:7],
_TextOperationName[7:11],
_TextOperationName[11:15],
_TextOperationName[15:19],
_TextOperationName[19:23],
_TextOperationName[23:27],
_TextOperationName[27:28],
_TextOperationName[28:30],
}
// TextOperationString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func TextOperationString(s string) (TextOperation, error) {
if val, ok := _TextOperationNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _TextOperationNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to TextOperation values", s)
}
// TextOperationValues returns all values of the enum
func TextOperationValues() []TextOperation {
return _TextOperationValues
}
// TextOperationStrings returns a slice of all String values of the enum
func TextOperationStrings() []string {
strs := make([]string, len(_TextOperationNames))
copy(strs, _TextOperationNames)
return strs
}
// IsATextOperation returns "true" if the value is listed in the enum definition. "false" otherwise
func (i TextOperation) IsATextOperation() bool {
for _, v := range _TextOperationValues {
if i == v {
return true
}
}
return false
}
const _BytesOperationName = "=<>"
var _BytesOperationIndex = [...]uint8{0, 1, 3}
const _BytesOperationLowerName = "=<>"
func (i BytesOperation) String() string {
i -= 1
if i >= BytesOperation(len(_BytesOperationIndex)-1) {
return fmt.Sprintf("BytesOperation(%d)", i+1)
}
return _BytesOperationName[_BytesOperationIndex[i]:_BytesOperationIndex[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 _BytesOperationNoOp() {
var x [1]struct{}
_ = x[BytesOperationEqual-(1)]
_ = x[BytesOperationNotEqual-(2)]
}
var _BytesOperationValues = []BytesOperation{BytesOperationEqual, BytesOperationNotEqual}
var _BytesOperationNameToValueMap = map[string]BytesOperation{
_BytesOperationName[0:1]: BytesOperationEqual,
_BytesOperationLowerName[0:1]: BytesOperationEqual,
_BytesOperationName[1:3]: BytesOperationNotEqual,
_BytesOperationLowerName[1:3]: BytesOperationNotEqual,
}
var _BytesOperationNames = []string{
_BytesOperationName[0:1],
_BytesOperationName[1:3],
}
// BytesOperationString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func BytesOperationString(s string) (BytesOperation, error) {
if val, ok := _BytesOperationNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _BytesOperationNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to BytesOperation values", s)
}
// BytesOperationValues returns all values of the enum
func BytesOperationValues() []BytesOperation {
return _BytesOperationValues
}
// BytesOperationStrings returns a slice of all String values of the enum
func BytesOperationStrings() []string {
strs := make([]string, len(_BytesOperationNames))
copy(strs, _BytesOperationNames)
return strs
}
// IsABytesOperation returns "true" if the value is listed in the enum definition. "false" otherwise
func (i BytesOperation) IsABytesOperation() bool {
for _, v := range _BytesOperationValues {
if i == v {
return true
}
}
return false
}