zitadel/internal/query/instanceindex_enumer.go
Tim Möhlmann 25dc7bfe72
perf(cache): pgx pool connector (#8703)
# Which Problems Are Solved

Cache implementation using a PGX connection pool.

# How the Problems Are Solved

Defines a new schema `cache` in the zitadel database.
A table for string keys and a table for objects is defined.
For postgreSQL, tables are unlogged and partitioned by cache name for
performance.

Cockroach does not have unlogged tables and partitioning is an
enterprise feature that uses alternative syntax combined with sharding.
Regular tables are used here.

# Additional Changes

- `postgres.Config` can return a pxg pool. See following discussion

# Additional Context

- Part of https://github.com/zitadel/zitadel/issues/8648
- Closes https://github.com/zitadel/zitadel/issues/8647

---------

Co-authored-by: Silvan <silvan.reusser@gmail.com>
2024-10-04 13:15:41 +00:00

83 lines
2.4 KiB
Go

// 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
}