Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
//! over a secondary index into a grovedb path query. Dispatch lives on
//! `DriveDocumentQuery::get_non_primary_key_path_query` in the parent
//! module; the per-version implementations live here so already-live
//! behavior is isolated from later edits.
//! behavior is isolated from later edits. From v1 on, the lowering only
//! routes by query shape — the shape lowerings themselves are versioned
//! methods in the `single_in_path_query` and `multiple_in_path_query`
//! submodules.

mod multiple_in_path_query;
mod single_in_path_query;
mod v0;
mod v1;
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//! Versioned lowering for document queries with multiple
//! non-primary-key `In` clauses on consecutive index properties,
//! dispatched by
//! `DriveDocumentQueryMethodVersions.non_primary_key_multiple_in_path_query`.
//! Only reachable through the v1+ non-primary-key lowering: the v0
//! lowering rejects these shapes before selection.

mod v0;

use crate::error::drive::DriveError;
use crate::error::Error;
use crate::query::DriveDocumentQuery;
use dpp::document::Document;
use dpp::version::PlatformVersion;
use grovedb::PathQuery;

impl<'a> DriveDocumentQuery<'a> {
#[cfg(any(feature = "server", feature = "verify"))]
/// Lowers a query with multiple `In` clauses into a path query whose
/// levels carry one key set per `In` clause.
pub(in crate::query) fn get_non_primary_key_multiple_in_path_query(
&self,
document_type_path: Vec<Vec<u8>>,
starts_at_document: Option<(Document, bool)>,
platform_version: &PlatformVersion,
) -> Result<PathQuery, Error> {
match platform_version
.drive
.methods
.document
.query
.non_primary_key_multiple_in_path_query
{
0 => self.get_non_primary_key_multiple_in_path_query_v0(
document_type_path,
starts_at_document,
platform_version,
),
version => Err(Error::Drive(DriveError::UnknownVersionMismatch {
method: "DriveDocumentQuery::get_non_primary_key_multiple_in_path_query"
.to_string(),
known_versions: vec![0],
received: version,
})),
}
}
}
Loading
Loading