mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 19:17:32 +00:00
perf: query data AS OF SYSTEM TIME
(#5231)
Queries the data in the storage layser at the timestamp when the call hit the API layer
This commit is contained in:
@@ -12,14 +12,15 @@ import (
|
||||
// SearchQueryBuilder represents the builder for your filter
|
||||
// if invalid data are set the filter will fail
|
||||
type SearchQueryBuilder struct {
|
||||
columns repository.Columns
|
||||
limit uint64
|
||||
desc bool
|
||||
resourceOwner string
|
||||
instanceID string
|
||||
editorUser string
|
||||
queries []*SearchQuery
|
||||
tx *sql.Tx
|
||||
columns repository.Columns
|
||||
limit uint64
|
||||
desc bool
|
||||
resourceOwner string
|
||||
instanceID string
|
||||
editorUser string
|
||||
queries []*SearchQuery
|
||||
tx *sql.Tx
|
||||
allowTimeTravel bool
|
||||
}
|
||||
|
||||
type SearchQuery struct {
|
||||
@@ -130,6 +131,13 @@ func (builder *SearchQueryBuilder) EditorUser(id string) *SearchQueryBuilder {
|
||||
return builder
|
||||
}
|
||||
|
||||
// AllowTimeTravel activates the time travel feature of the database if supported
|
||||
// The queries will be made based on the call time
|
||||
func (builder *SearchQueryBuilder) AllowTimeTravel() *SearchQueryBuilder {
|
||||
builder.allowTimeTravel = true
|
||||
return builder
|
||||
}
|
||||
|
||||
// AddQuery creates a new sub query.
|
||||
// All fields in the sub query are AND-connected in the storage request.
|
||||
// Multiple sub queries are OR-connected in the storage request.
|
||||
@@ -264,11 +272,12 @@ func (builder *SearchQueryBuilder) build(instanceID string) (*repository.SearchQ
|
||||
}
|
||||
|
||||
return &repository.SearchQuery{
|
||||
Columns: builder.columns,
|
||||
Limit: builder.limit,
|
||||
Desc: builder.desc,
|
||||
Filters: filters,
|
||||
Tx: builder.tx,
|
||||
Columns: builder.columns,
|
||||
Limit: builder.limit,
|
||||
Desc: builder.desc,
|
||||
Filters: filters,
|
||||
Tx: builder.tx,
|
||||
AllowTimeTravel: builder.allowTimeTravel,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user