mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 03:24:26 +00:00
12be21a3ff
creates events structures for initial projections and read models
37 lines
529 B
Go
37 lines
529 B
Go
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
|
|
}
|