Skip to main content

Module query

Module query 

Source
Expand description

Query module

Re-exports§

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.
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. See book/src/drive/average-index-examples.md for 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 GetDocumentsCount query.
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-HAVING range 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_query for the sum surface — see book/src/drive/document-sum-trees.md for the design and book/src/drive/sum-index-examples.md for the worked example contract. DriveDocumentSumQuery — Drive’s sum-query surface.
filter
Document subscription filtering Document subscription filtering
having
HAVING clause types for the v1 getDocuments aggregate 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
ordering
Query Ordering
projection
SELECT projection types for the v1 getDocuments surface.
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§

ClauseFieldRoles
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 postId is a prefix property of byHashtagPost/byPost AND the terminal of byLiker.
DriveDocumentQuery
Drive query struct
InternalClauses
Internal clauses struct
PathQuery
Path query
Query
Query represents one or more keys or ranges of keys, which can be used to resolve a proof which will include all the requested values.
QueryResultElements
Query result elements
ResolvedTimeRange
Resolution provenance for one IN_TIME_RANGE clause: the field the selector named and the exact grid the resolution used. Recorded by the resolver’s caller on the query (see DriveDocumentQuery::resolved_time_ranges) and consumed by the index pickers through index_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.
SingleDocumentDriveQuery
Drive query struct
SizedQuery
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.
StartAtDocument
Represents a starting point for a query based on a specific document.
TimeRangeGridSpec
A concrete grid specification, matching a contract’s timeRange declaration verbatim (range / step / phase, in seconds).

Enums§

Element
Variants of GroveDB stored entities
GroveError
GroveDB Errors
QueryItem
A QueryItem represents a key or a range of keys to be included in a proof.
QueryResultType
Query result type
SingleDocumentDriveQueryContestedStatus
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
TimeRangeSelector
Which active time range a TOP(timeRange(...)) selection resolves to, when the index’s ranges overlap (range > step). 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.
index_admissible_for_resolved_time_range
Whether index may serve a query whose equality clauses on resolved_time_ranges were produced by resolve_time_range_bucket_clause.
resolve_time_range_bucket_clause
Resolves a time-range selection on field into a concrete equality WhereClause on the bucketed source field, using the named grid’s timeRange transform and an authoritative block_time_ms.
validate_resolved_time_range_clause_shapes
Rejects a query whose resolution provenance and clause shapes disagree: every field in resolved_time_ranges must appear in the where clauses as exactly one Equal clause — the only shape resolve_time_range_bucket_clause produces.

Type Aliases§

ContractLookupFn
Function type for looking up a contract by identifier
QuerySyntaxSimpleValidationResult
A Query Syntax Validation Result
QuerySyntaxValidationResult
A Query Syntax Validation Result that contains data
TransactionArg
TransactionArg