zitadel/internal/admin/repository/eventsourcing/view/sequence.go
Fabi 423b86a03b
feat: sequence and timestamp on searchrequests (#468)
* feat: reread events

* feat: sequence and timestamo on search requests

* feat: sequence and timestamo on search requests

* fix: better naming

* fix: log errors

* fix: read sequence before search request
2020-07-15 13:24:36 +02:00

28 lines
813 B
Go

package view
import (
"github.com/caos/zitadel/internal/view/repository"
)
const (
sequencesTable = "adminapi.current_sequences"
)
func (v *View) saveCurrentSequence(viewName string, sequence uint64) error {
return repository.SaveCurrentSequence(v.Db, sequencesTable, viewName, sequence)
}
func (v *View) latestSequence(viewName string) (*repository.CurrentSequence, error) {
return repository.LatestSequence(v.Db, sequencesTable, viewName)
}
func (v *View) AllCurrentSequences(db string) ([]*repository.CurrentSequence, error) {
return repository.AllCurrentSequences(v.Db, db+".current_sequences")
}
func (v *View) ClearView(db, viewName string) error {
truncateView := db + "." + viewName
sequenceTable := db + ".current_sequences"
return repository.ClearView(v.Db, truncateView, sequenceTable)
}