mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:17:32 +00:00
refactor(v2): init events (#7823)
creates events structures for initial projections and read models
This commit is contained in:
36
internal/v2/org/state.go
Normal file
36
internal/v2/org/state.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package org
|
||||
|
||||
type State uint8
|
||||
|
||||
const (
|
||||
UndefinedState State = iota
|
||||
ActiveState
|
||||
InactiveState
|
||||
RemovedState
|
||||
maxState
|
||||
)
|
||||
|
||||
func (s State) IsValid() bool {
|
||||
return s != UndefinedState ||
|
||||
s < maxState
|
||||
}
|
||||
|
||||
func (s State) Is(state State) bool {
|
||||
return s == state
|
||||
}
|
||||
|
||||
func (s State) IsValidState(state State) bool {
|
||||
return s.IsValid() && s.Is(state)
|
||||
}
|
||||
|
||||
func (s State) IsValidStates(states ...State) bool {
|
||||
if !s.IsValid() {
|
||||
return false
|
||||
}
|
||||
for _, state := range states {
|
||||
if s.Is(state) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
Reference in New Issue
Block a user