Expand description
Query module
Re-exports§
pub use chained_document_query::ChainedDocumentsResult;pub use chained_document_query::ChainedOuterDocuments;pub use chained_document_query::MAX_CHAINED_JOIN_VALUES;pub use composite_document_query::BindingSource;pub use composite_document_query::CompositeDocumentsResult;pub use composite_document_query::DriveSubQuery;pub use composite_document_query::SubQueryBinding;pub use composite_document_query::SubQueryKind;pub use composite_document_query::SubQueryResult;pub use composite_document_query::MAX_BOUND_VALUES;pub use composite_document_query::MAX_SUB_QUERIES;pub use conditions::ValueClause;pub use conditions::WhereClause;pub use conditions::WhereOperator;pub use drive_document_average_query::AverageEntry;pub use drive_document_average_query::AverageMode;pub use drive_document_count_query::CountMode;pub use drive_document_count_query::DocumentCountMode;pub use drive_document_count_query::DriveDocumentCountQuery;pub use drive_document_count_query::SplitCountEntry;pub use drive_document_having_query::AxisRangeBounds;pub use drive_document_having_query::DocumentHavingMode;pub use drive_document_having_query::DriveDocumentHavingQuery;pub use drive_document_having_query::MAX_HAVING_LIMIT;pub use drive_document_ranked_query::DocumentRankedMode;pub use drive_document_ranked_query::DriveDocumentRankedQuery;pub use drive_document_ranked_query::RankedAxis;pub use drive_document_ranked_query::RankedEntry;pub use drive_document_ranked_query::RankedEntryValue;pub use drive_document_ranked_query::RankedPage;pub use drive_document_ranked_query::RankedPaginationInputs;pub use drive_document_ranked_query::MAX_RANKED_LIMIT;pub use drive_document_ranked_query::RANKED_COUNT_ORDER_KEY;pub use drive_document_sum_query::DriveDocumentSumQuery;pub use drive_document_sum_query::SumEntry;pub use drive_document_sum_query::SumMode;pub use having::HavingAggregate;pub use having::HavingAggregateFunction;pub use having::HavingClause;pub use having::HavingOperator;pub use having::HavingRightOperand;pub use ordering::OrderClause;pub use projection::SelectFunction;pub use projection::SelectProjection;pub use vote_polls_by_end_date_query::VotePollsByEndDateDriveQuery;pub use vote_query::IdentityBasedVoteDriveQuery;pub use drive_document_count_query::DocumentCountRequest;pub use drive_document_count_query::DocumentCountResponse;pub use drive_document_count_query::RangeCountOptions;pub use drive_document_count_query::MAX_LIMIT_AS_FAILSAFE;pub use drive_document_sum_query::DocumentSumRequest;pub use drive_document_sum_query::DocumentSumResponse;pub use drive_document_sum_query::RangeSumOptions;pub use drive_document_sum_query::RangeSumWalkMode;pub use drive_document_average_query::DocumentAverageRequest;pub use drive_document_average_query::DocumentAverageResponse;pub use drive_document_ranked_query::DocumentRankedRequest;pub use drive_document_ranked_query::DocumentRankedResponse;pub use drive_document_having_query::DocumentHavingRequest;pub use drive_document_having_query::DocumentHavingResponse;pub use canonicalize::validate_and_canonicalize_where_clauses;
Modules§
- canonicalize
- Shared where-clause validation + canonicalization for the aggregate query surfaces (count / sum / average / joint count-and-sum) and their SDK proof verifiers.
- chained_
document_ query - Chained document queries — a provable semi-join: an inner indexOnly
DriveDocumentQuerywhose provenrefersTovalues become the outer query’s primary keys (carried as a single by-id join inDriveDocumentQuery::sub_queries), proven against one state root. See the module docs. Chained document queries: a provable semi-join. - composite_
document_ query - Composite document queries — a
DriveDocumentQuerypage plus sub-queries derived from its proven results (joins, lookups, counts), proven as one merged proof against one state root. See the module docs. Composite document queries: one page query plus sub-queries derived from its proven results, answered as ONE merged grovedb proof. - conditions
- Query Conditions
- contested_
resource_ votes_ given_ by_ identity_ query - A query to get the votes given out by an identity
- drive_
contested_ document_ query - A query to get contested documents before they have been awarded
- drive_
document_ average_ query - A query to compute the average of an integer property across
documents using
CountSumTree/ProvableCountProvableSumTree(PCPS) elements. Averages are NOT computed server-side; the response carries a(count, sum)pair (atomic per group) and the client divides. Seebook/src/drive/average-index-examples.mdfor the worked example contract.DriveDocumentAverageQuery— Drive’s average-query surface. - drive_
document_ count_ and_ sum_ query - Joint count-and-sum no-prove executor surface — backs the AVG no-prove path’s unified single-walk dispatch. See its module docstring for the perf / atomicity contract. Server-only because the surface only fires on the no-prove (server-materialized) path. Joint count-and-sum executor surface for the AVG no-prove path.
- drive_
document_ count_ query - A query to count documents using CountTree elements
Types and module structure for the
GetDocumentsCountquery. - drive_
document_ having_ query - A query to filter an index’s groups by a per-group aggregate bound —
“hashtags with more than 100 posts” — served as a value-bounded
range read of the same per-axis secondary Merk the ranked surface
walks (PR #657, PV14). Like ranked, it never opens the value trees,
so a having-range read is
O(log n + k)with a proof. Types and module structure for the boolean-HAVINGrange document query —SELECT <agg> GROUP BY <prop> HAVING <agg> <op> <value> [ORDER BY <agg> ASC|DESC] LIMIT n. - drive_
document_ ranked_ query - A query to rank an index’s groups by a per-group aggregate — “top
5 restaurants by average grade” — reading grovedb’s per-axis
secondary Merk of an indexed tree (PR #657, PV14). Unlike the
count / sum / average surfaces this one never opens the value
trees: the ordering is maintained on write, so a ranked read is
O(log n + k)with a proof. Types and module structure for the ranked (top-k / bottom-k) document query —SELECT <agg> GROUP BY <prop> ORDER BY <agg> DESC LIMIT n OFFSET m. - drive_
document_ sum_ query - A query to sum an integer property across documents using SumTree
elements. Parallels
drive_document_count_queryfor the sum surface — seebook/src/drive/document-sum-trees.mdfor the design andbook/src/drive/sum-index-examples.mdfor the worked example contract.DriveDocumentSumQuery— Drive’s sum-query surface. - filter
- Document subscription filtering Document subscription filtering
- having
HAVINGclause types for the v1getDocumentsaggregate surface.- identity_
token_ balance_ drive_ query - A query to get the identity’s token balance
- identity_
token_ info_ drive_ query - A query to get the identity’s token info
- moderated_
join - Joins through a
refersTo: moderatedDocumentproperty: the removal records a chained or composite join proves beside the documents it joins. See the module docs. Joins through arefersTo: moderatedDocumentproperty: the removal records a join proves beside the documents it joins. - ordering
- Query Ordering
- projection
SELECTprojection types for the v1getDocumentssurface.- proposer_
block_ count_ query - A query to get the block counts of proposers in an epoch
- token_
status_ drive_ query - A query to get the token’s status
- vote_
poll_ contestant_ votes_ query - Vote poll contestant votes query module
- vote_
poll_ vote_ state_ query - Vote poll vote state query module
- vote_
polls_ by_ document_ type_ query - Vote polls by document type query
- vote_
polls_ by_ end_ date_ query - Vote polls by end date query
- vote_
query - Vote Query module
Structs§
- Clause
Field Roles - How one where-clause (or order-by) field relates to a document type’s
indexes — classified ONCE against the doctype instead of re-derived by
every consumer. Roles are not exclusive: on the yappr fixture
postIdis a prefix property ofbyHashtagPost/byPostAND the terminal ofbyLiker. - Drive
Document Query - Drive query struct
- Integer
Range Grid Spec - A concrete integer grid, matching a contract’s
integerRangedeclaration verbatim (range/step/phase). - Internal
Clauses - Internal clauses struct
- Path
Query - Path query
- Query
Queryrepresents one or more keys or ranges of keys, which can be used to resolve a proof which will include all the requested values.- Query
Result Elements - Query result elements
- Resolved
Time Range - Resolution provenance for one window selection — an
IN_TIME_RANGEor anIN_INTEGER_RANGEclause: the field the selection named and the exact grid the resolution used. Recorded by the resolver’s caller on the query (seeDriveDocumentQuery::resolved_time_ranges) and consumed by the index pickers throughindex_admissible_for_resolved_time_range, which pins selection to the index carrying exactly this grid — a field may be bucketed by several grids, so the field name alone no longer identifies the index the resolution was computed against. - Single
Document Drive Query - Drive query struct
- Sized
Query - Holds a query to apply to a tree and an optional limit/offset value. Limit and offset values affect the size of the result set.
- Skip
IfAbsent Binding - How a query constrains one field, as the
skipIfAbsentgate reads it (index_admissible_for_skip_if_absent). - Start
AtDocument - Represents a starting point for a query based on a specific document.
- Time
Range Grid Spec - A concrete grid specification, matching a contract’s
timeRangedeclaration verbatim (range/step/phase, in seconds).
Enums§
- Element
- Variants of GroveDB stored entities
- Grove
Error - GroveDB Errors
- Query
Item - A
QueryItemrepresents a key or a range of keys to be included in a proof. - Query
Result Type - Query result type
- Single
Document Drive Query Contested Status - The expected contested status of a document Drives stores the document in either the not contested location (most of the time) Or a temporary contested area while the contest is ongoing
- Time
Range Selector - Which window of a
timeRangegrid anIN_TIME_RANGEselection resolves to. Time-range queries are a v1-only feature; the v0 query surface is unaffected.
Constants§
- RANKED_
AVG_ SCALE - The fixed-point scale grovedb’s Avg axis sorts by:
avg_fixed_point = floor(sum * RANKED_AVG_SCALE / count)with euclidean (toward -∞) division.
Functions§
- contract_
lookup_ fn_ for_ contract - Creates a ContractLookupFn function that returns provided data contract when requested.
- document_
index_ admissible_ for_ query index_admissible_for_queryfor a picker reading documents through the index’s entries: asummableOffCountIndexindex keeps none (its source serves the documents it counts), so it never serves such a read.- index_
admissible_ for_ query - Whether
indexmay serve a query at all: the one candidate filter every index picker applies, so no picker can take one rule and miss the other. It joins the time-range provenance rule (index_admissible_for_resolved_time_range) and theskipIfAbsentrule (index_admissible_for_skip_if_absent). A picker reading documents through the index’s entries appliesdocument_index_admissible_for_queryinstead. - index_
admissible_ for_ resolved_ time_ range - Whether
indexmay serve a query whose equality clauses onresolved_time_rangeswere produced byresolve_time_range_bucket_clauseorresolve_integer_range_bucket_clause. - index_
admissible_ for_ skip_ if_ absent - Whether a query constraining fields as
bindingsmay be served byindexgiven itsskipIfAbsentparticipation. - index_
only_ serialization_ refusal - The query error a failure serializing a document an indexOnly index
synthesized answers a non-proof read with,
Nonewhen the failure is no query’s doing: a missing required property, whichDriveDocumentQuery::refuse_an_uncovered_index_only_projectionrefuses before the read, so this only guards a read that check let through. The documents query and drive-abci’s chained and composite handlers share it. - pins_
reach_ chain - Whether a point read pinning the first
pin_depthproperties ofindexmay stop at the deepest pin’s value tree: the pins reach the chain starting atchain_position(the shallowest rankedatlevel, whose value trees and every one below aggregate their whole subtree) and leave a deeper property free. The count and sum pickers and path builders all ask this, each with its own chain position, so a picker never admits what its builder refuses. - refuse_
a_ range_ total_ through_ a_ ranked_ index - Refuses a range total (one aggregate over a range, or one per carrier
branch) read through
indexwhen its path passes through a ranked level: a level whose property-name tree Drive lays out as an indexed tree, whichever of the type’s indexes ranks it (an index may continue below another’s ranked last property). It walks the type’s index structure along the index’s levels and asks each the resolver the write path uses ([property_name_tree_type_and_ranked_axes_for_level]), so it reads the layout Drive builds. grovedb’s range aggregates neither read an indexed tree (AggregateCountOnRange,AggregateSumOnRangeandAggregateCountAndSumOnRangetake provable trees only) nor descend through one when proving. An unproven read through a ranked ancestor would succeed (it opens only the leaf tree), but it is refused as well: every count, sum and count-and-sum range-total path builder calls this, so the unproven read, the proof and its verification refuse alike rather than answering only without a proof. Grouped by the last property, the same range reads each value. - resolve_
integer_ range_ bucket_ clause - Resolves an
IN_INTEGER_RANGEselection onfield— the window of anintegerRangegrid starting atstart— into a concrete equalityWhereClauseon the bucketed source field, plus theResolvedTimeRangeprovenance callers must record on the query (seeDriveDocumentQuery::resolved_time_ranges). - resolve_
time_ range_ bucket_ clause - Resolves a time-range selection on
fieldinto a concrete equalityWhereClauseon the bucketed source field, using the named grid’stimeRangetransform and an authoritativeblock_time_ms. - uncovered_
required_ property_ refusal - The refusal of a non-proof read whose indexOnly documents lack a required
property their index does not hold, so they cannot be serialized: the
query’s doing, refused with a query error (
Unsupported), not an internal one. - validate_
resolved_ time_ range_ clause_ shapes - Rejects a query whose resolution provenance and clause shapes disagree:
every field in
resolved_time_rangesmust appear in the where clauses as exactly oneEqualclause — the only shaperesolve_time_range_bucket_clauseproduces.
Type Aliases§
- Contract
Lookup Fn - Function type for looking up a contract by identifier
- Query
Syntax Simple Validation Result - A Query Syntax Validation Result
- Query
Syntax Validation Result - A Query Syntax Validation Result that contains data
- Transaction
Arg - TransactionArg