feat(job-array-one-based-index): row predicates in the apiserver query pipeline (task 5.3)

QueryOptions gains Predicates; store.ExecuteQuery keeps a row only if
every predicate returns true, after the plain conditions and before
sort, pagination and field selection, so page boundaries and tokens
count only matching rows. Nil/empty predicates leave every existing
query unchanged. Foundation for evaluating element selections
(bug-1898).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-10-01 11:35:05 +00:00
parent 7f417262c5
commit 46f57095c1
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
4 changed files with 177 additions and 5 deletions

View file

@ -97,6 +97,12 @@ type QueryOptions struct {
Orders []SortOrder
Limit int
Bookmark string
// Predicates are row predicates (e.g. job element selections) that
// store.ExecuteQuery evaluates after Conditions and before sort and
// pagination. A row is kept only if every predicate returns true;
// nil or empty means no extra filtering. Set them on the result of
// BuildQueryOptions; the builder does not take them.
Predicates []func(OrderMap) bool
}
// OrderMap represents a row of data with ordered field names.
@ -480,7 +486,6 @@ func FormatTimestamp(ts int64) string {
return t.Local().Format("2006-01-02 15:04:05")
}
// Supported query parameter lists for validation.
var (
SupportedQueryParams = []string{"filter", "sort", "limit", "page_token", "fields"}