mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 09:57:33 +00:00
chore: move the go code into a subfolder
This commit is contained in:
29
apps/api/internal/v2/eventstore/current_sequence.go
Normal file
29
apps/api/internal/v2/eventstore/current_sequence.go
Normal file
@@ -0,0 +1,29 @@
|
||||
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
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user