Files
zitadel/backend/v3/domain/authorizationstate_enumer.go
T
8472c7683d feat(rt): authorizations (#11066)
# Which Problems Are Solved

This PR implements relational table and repository interface for the
authorizations feature as described in
https://github.com/zitadel/zitadel/issues/10767

# How the Problems Are Solved

By
* adding new `zitadel.authorizations` and `zitadel.authorization_roles`
tables
* implementing the `AuthorizationRepository` interface to create,
update, query, and delete user authorizations and roles
* implementing `authorization_relational.go` projection to update
`zitadel.authorizations` and `zitadel.authorization_roles` tables based
on events

# Additional Changes
N/A

# Additional Context
- Closes #10767

---------

Co-authored-by: Livio Spring <[email protected]>
2025-12-19 07:03:27 +01:00

110 lines
3.0 KiB
Go

// Code generated by "enumer -type AuthorizationState -transform lower -trimprefix AuthorizationState -sql"; DO NOT EDIT.
package domain
import (
"database/sql/driver"
"fmt"
"strings"
)
const _AuthorizationStateName = "activeinactive"
var _AuthorizationStateIndex = [...]uint8{0, 6, 14}
const _AuthorizationStateLowerName = "activeinactive"
func (i AuthorizationState) String() string {
if i >= AuthorizationState(len(_AuthorizationStateIndex)-1) {
return fmt.Sprintf("AuthorizationState(%d)", i)
}
return _AuthorizationStateName[_AuthorizationStateIndex[i]:_AuthorizationStateIndex[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 _AuthorizationStateNoOp() {
var x [1]struct{}
_ = x[AuthorizationStateActive-(0)]
_ = x[AuthorizationStateInactive-(1)]
}
var _AuthorizationStateValues = []AuthorizationState{AuthorizationStateActive, AuthorizationStateInactive}
var _AuthorizationStateNameToValueMap = map[string]AuthorizationState{
_AuthorizationStateName[0:6]: AuthorizationStateActive,
_AuthorizationStateLowerName[0:6]: AuthorizationStateActive,
_AuthorizationStateName[6:14]: AuthorizationStateInactive,
_AuthorizationStateLowerName[6:14]: AuthorizationStateInactive,
}
var _AuthorizationStateNames = []string{
_AuthorizationStateName[0:6],
_AuthorizationStateName[6:14],
}
// AuthorizationStateString retrieves an enum value from the enum constants string name.
// Throws an error if the param is not part of the enum.
func AuthorizationStateString(s string) (AuthorizationState, error) {
if val, ok := _AuthorizationStateNameToValueMap[s]; ok {
return val, nil
}
if val, ok := _AuthorizationStateNameToValueMap[strings.ToLower(s)]; ok {
return val, nil
}
return 0, fmt.Errorf("%s does not belong to AuthorizationState values", s)
}
// AuthorizationStateValues returns all values of the enum
func AuthorizationStateValues() []AuthorizationState {
return _AuthorizationStateValues
}
// AuthorizationStateStrings returns a slice of all String values of the enum
func AuthorizationStateStrings() []string {
strs := make([]string, len(_AuthorizationStateNames))
copy(strs, _AuthorizationStateNames)
return strs
}
// IsAAuthorizationState returns "true" if the value is listed in the enum definition. "false" otherwise
func (i AuthorizationState) IsAAuthorizationState() bool {
for _, v := range _AuthorizationStateValues {
if i == v {
return true
}
}
return false
}
func (i AuthorizationState) Value() (driver.Value, error) {
return i.String(), nil
}
func (i *AuthorizationState) 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 AuthorizationState: %[1]T(%[1]v)", value)
}
val, err := AuthorizationStateString(str)
if err != nil {
return err
}
*i = val
return nil
}