mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 19:44:21 +00:00
5811a7b6a5
* refactor(v2): init database package * refactor(v2): init eventstore package * add mock package * test query constructors * option based push analog to query
30 lines
675 B
Go
30 lines
675 B
Go
package eventstore
|
|
|
|
type CurrentSequence func(current uint32) bool
|
|
|
|
func CheckSequence(current uint32, check CurrentSequence) bool {
|
|
if check == nil {
|
|
return true
|
|
}
|
|
return check(current)
|
|
}
|
|
|
|
// SequenceIgnore doesn't check the current sequence
|
|
func SequenceIgnore() CurrentSequence {
|
|
return nil
|
|
}
|
|
|
|
// SequenceMatches exactly the provided sequence
|
|
func SequenceMatches(sequence uint32) CurrentSequence {
|
|
return func(current uint32) bool {
|
|
return current == sequence
|
|
}
|
|
}
|
|
|
|
// SequenceAtLeast matches the given sequence <= the current sequence
|
|
func SequenceAtLeast(sequence uint32) CurrentSequence {
|
|
return func(current uint32) bool {
|
|
return current >= sequence
|
|
}
|
|
}
|