mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 19:44:21 +00:00
250f2344c8
# Which Problems Are Solved Add a cache implementation using Redis single mode. This does not add support for Redis Cluster or sentinel. # How the Problems Are Solved Added the `internal/cache/redis` package. All operations occur atomically, including setting of secondary indexes, using LUA scripts where needed. The [`miniredis`](https://github.com/alicebob/miniredis) package is used to run unit tests. # Additional Changes - Move connector code to `internal/cache/connector/...` and remove duplicate code from `query` and `command` packages. - Fix a missed invalidation on the restrictions projection # Additional Context Closes #8130
83 lines
2.2 KiB
Go
83 lines
2.2 KiB
Go
// Code generated by "enumer -type Purpose -transform snake -trimprefix Purpose"; DO NOT EDIT.
|
|
|
|
package cache
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
const _PurposeName = "unspecifiedauthz_instancemilestones"
|
|
|
|
var _PurposeIndex = [...]uint8{0, 11, 25, 35}
|
|
|
|
const _PurposeLowerName = "unspecifiedauthz_instancemilestones"
|
|
|
|
func (i Purpose) String() string {
|
|
if i < 0 || i >= Purpose(len(_PurposeIndex)-1) {
|
|
return fmt.Sprintf("Purpose(%d)", i)
|
|
}
|
|
return _PurposeName[_PurposeIndex[i]:_PurposeIndex[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 _PurposeNoOp() {
|
|
var x [1]struct{}
|
|
_ = x[PurposeUnspecified-(0)]
|
|
_ = x[PurposeAuthzInstance-(1)]
|
|
_ = x[PurposeMilestones-(2)]
|
|
}
|
|
|
|
var _PurposeValues = []Purpose{PurposeUnspecified, PurposeAuthzInstance, PurposeMilestones}
|
|
|
|
var _PurposeNameToValueMap = map[string]Purpose{
|
|
_PurposeName[0:11]: PurposeUnspecified,
|
|
_PurposeLowerName[0:11]: PurposeUnspecified,
|
|
_PurposeName[11:25]: PurposeAuthzInstance,
|
|
_PurposeLowerName[11:25]: PurposeAuthzInstance,
|
|
_PurposeName[25:35]: PurposeMilestones,
|
|
_PurposeLowerName[25:35]: PurposeMilestones,
|
|
}
|
|
|
|
var _PurposeNames = []string{
|
|
_PurposeName[0:11],
|
|
_PurposeName[11:25],
|
|
_PurposeName[25:35],
|
|
}
|
|
|
|
// PurposeString retrieves an enum value from the enum constants string name.
|
|
// Throws an error if the param is not part of the enum.
|
|
func PurposeString(s string) (Purpose, error) {
|
|
if val, ok := _PurposeNameToValueMap[s]; ok {
|
|
return val, nil
|
|
}
|
|
|
|
if val, ok := _PurposeNameToValueMap[strings.ToLower(s)]; ok {
|
|
return val, nil
|
|
}
|
|
return 0, fmt.Errorf("%s does not belong to Purpose values", s)
|
|
}
|
|
|
|
// PurposeValues returns all values of the enum
|
|
func PurposeValues() []Purpose {
|
|
return _PurposeValues
|
|
}
|
|
|
|
// PurposeStrings returns a slice of all String values of the enum
|
|
func PurposeStrings() []string {
|
|
strs := make([]string, len(_PurposeNames))
|
|
copy(strs, _PurposeNames)
|
|
return strs
|
|
}
|
|
|
|
// IsAPurpose returns "true" if the value is listed in the enum definition. "false" otherwise
|
|
func (i Purpose) IsAPurpose() bool {
|
|
for _, v := range _PurposeValues {
|
|
if i == v {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|