Struct dash_sdk::platform::DocumentQuery
source · pub struct DocumentQuery {
pub data_contract: Arc<DataContract>,
pub document_type_name: String,
pub where_clauses: Vec<WhereClause>,
pub order_by_clauses: Vec<OrderClause>,
pub limit: u32,
pub start: Option<Start>,
}
Expand description
Request that is used to query documents from the Dash Platform.
This is an abstraction layer built on top of GetDocumentsRequest to address issues with missing details required to correctly verify proofs returned by the Dash Platform.
Conversions are implemented between this type, GetDocumentsRequest and DriveDocumentQuery using TryFrom trait.
Fields§
§data_contract: Arc<DataContract>
Data contract ID
document_type_name: String
Document type for the data contract
where_clauses: Vec<WhereClause>
where
clauses for the query
order_by_clauses: Vec<OrderClause>
order_by
clauses for the query
limit: u32
queryset limit
start: Option<Start>
first object to start with
Implementations§
source§impl DocumentQuery
impl DocumentQuery
sourcepub fn new<C: Into<Arc<DataContract>>>(
contract: C,
document_type_name: &str,
) -> Result<Self, Error>
pub fn new<C: Into<Arc<DataContract>>>( contract: C, document_type_name: &str, ) -> Result<Self, Error>
Create new DocumentQuery for provided contract and document type name.
sourcepub fn new_with_drive_query(d: &DriveDocumentQuery<'_>) -> Self
pub fn new_with_drive_query(d: &DriveDocumentQuery<'_>) -> Self
Create new document query based on a DriveDocumentQuery.
sourcepub async fn new_with_data_contract_id(
api: &Sdk,
data_contract_id: Identifier,
document_type_name: &str,
) -> Result<Self, Error>
pub async fn new_with_data_contract_id( api: &Sdk, data_contract_id: Identifier, document_type_name: &str, ) -> Result<Self, Error>
Create new document query for provided document type name and data contract ID.
Note that this method will fetch data contract first.
sourcepub fn with_document_id(self, document_id: &Identifier) -> Self
pub fn with_document_id(self, document_id: &Identifier) -> Self
Point to a specific document ID.
sourcepub fn with_where(self, clause: WhereClause) -> Self
pub fn with_where(self, clause: WhereClause) -> Self
Add new where clause to the query.
Existing where clauses will be preserved.
sourcepub fn with_order_by(self, clause: OrderClause) -> Self
pub fn with_order_by(self, clause: OrderClause) -> Self
Add order by clause to the query.
Existing order by clauses will be preserved.
Trait Implementations§
source§impl Clone for DocumentQuery
impl Clone for DocumentQuery
source§fn clone(&self) -> DocumentQuery
fn clone(&self) -> DocumentQuery
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for DocumentQuery
impl Debug for DocumentQuery
source§impl<'de> Deserialize<'de> for DocumentQuery
impl<'de> Deserialize<'de> for DocumentQuery
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl<'a> From<&'a DriveDocumentQuery<'a>> for DocumentQuery
impl<'a> From<&'a DriveDocumentQuery<'a>> for DocumentQuery
source§fn from(value: &'a DriveDocumentQuery<'a>) -> Self
fn from(value: &'a DriveDocumentQuery<'a>) -> Self
source§impl<'a> From<DriveDocumentQuery<'a>> for DocumentQuery
impl<'a> From<DriveDocumentQuery<'a>> for DocumentQuery
source§fn from(value: DriveDocumentQuery<'a>) -> Self
fn from(value: DriveDocumentQuery<'a>) -> Self
source§impl FromProof<DocumentQuery> for Documents
impl FromProof<DocumentQuery> for Documents
§type Request = DocumentQuery
type Request = DocumentQuery
§type Response = GetDocumentsResponse
type Response = GetDocumentsResponse
source§fn maybe_from_proof_with_metadata<'a, I: Into<Self::Request>, O: Into<Self::Response>>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
provider: &'a dyn ContextProvider,
) -> Result<(Option<Self>, ResponseMetadata, Proof), Error>where
Self: Sized + 'a,
fn maybe_from_proof_with_metadata<'a, I: Into<Self::Request>, O: Into<Self::Response>>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
provider: &'a dyn ContextProvider,
) -> Result<(Option<Self>, ResponseMetadata, Proof), Error>where
Self: Sized + 'a,
§fn maybe_from_proof<'a, I, O>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
provider: &'a dyn ContextProvider,
) -> Result<Option<Self>, Error>
fn maybe_from_proof<'a, I, O>( request: I, response: O, network: Network, platform_version: &PlatformVersion, provider: &'a dyn ContextProvider, ) -> Result<Option<Self>, Error>
§fn from_proof<'a, I, O>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
provider: &'a dyn ContextProvider,
) -> Result<Self, Error>
fn from_proof<'a, I, O>( request: I, response: O, network: Network, platform_version: &PlatformVersion, provider: &'a dyn ContextProvider, ) -> Result<Self, Error>
§fn from_proof_with_metadata<'a, I, O>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
provider: &'a dyn ContextProvider,
) -> Result<(Self, ResponseMetadata), Error>
fn from_proof_with_metadata<'a, I, O>( request: I, response: O, network: Network, platform_version: &PlatformVersion, provider: &'a dyn ContextProvider, ) -> Result<(Self, ResponseMetadata), Error>
§fn from_proof_with_metadata_and_proof<'a, I, O>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
provider: &'a dyn ContextProvider,
) -> Result<(Self, ResponseMetadata, Proof), Error>
fn from_proof_with_metadata_and_proof<'a, I, O>( request: I, response: O, network: Network, platform_version: &PlatformVersion, provider: &'a dyn ContextProvider, ) -> Result<(Self, ResponseMetadata, Proof), Error>
source§impl FromProof<DocumentQuery> for Document
impl FromProof<DocumentQuery> for Document
§type Request = DocumentQuery
type Request = DocumentQuery
§type Response = GetDocumentsResponse
type Response = GetDocumentsResponse
source§fn maybe_from_proof_with_metadata<'a, I: Into<Self::Request>, O: Into<Self::Response>>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
provider: &'a dyn ContextProvider,
) -> Result<(Option<Self>, ResponseMetadata, Proof), Error>where
Self: Sized + 'a,
fn maybe_from_proof_with_metadata<'a, I: Into<Self::Request>, O: Into<Self::Response>>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
provider: &'a dyn ContextProvider,
) -> Result<(Option<Self>, ResponseMetadata, Proof), Error>where
Self: Sized + 'a,
§fn maybe_from_proof<'a, I, O>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
provider: &'a dyn ContextProvider,
) -> Result<Option<Self>, Error>
fn maybe_from_proof<'a, I, O>( request: I, response: O, network: Network, platform_version: &PlatformVersion, provider: &'a dyn ContextProvider, ) -> Result<Option<Self>, Error>
§fn from_proof<'a, I, O>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
provider: &'a dyn ContextProvider,
) -> Result<Self, Error>
fn from_proof<'a, I, O>( request: I, response: O, network: Network, platform_version: &PlatformVersion, provider: &'a dyn ContextProvider, ) -> Result<Self, Error>
§fn from_proof_with_metadata<'a, I, O>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
provider: &'a dyn ContextProvider,
) -> Result<(Self, ResponseMetadata), Error>
fn from_proof_with_metadata<'a, I, O>( request: I, response: O, network: Network, platform_version: &PlatformVersion, provider: &'a dyn ContextProvider, ) -> Result<(Self, ResponseMetadata), Error>
§fn from_proof_with_metadata_and_proof<'a, I, O>(
request: I,
response: O,
network: Network,
platform_version: &PlatformVersion,
provider: &'a dyn ContextProvider,
) -> Result<(Self, ResponseMetadata, Proof), Error>
fn from_proof_with_metadata_and_proof<'a, I, O>( request: I, response: O, network: Network, platform_version: &PlatformVersion, provider: &'a dyn ContextProvider, ) -> Result<(Self, ResponseMetadata, Proof), Error>
source§impl Mockable for DocumentQuery
impl Mockable for DocumentQuery
source§impl<'a> Query<DocumentQuery> for DriveDocumentQuery<'a>
impl<'a> Query<DocumentQuery> for DriveDocumentQuery<'a>
source§impl Serialize for DocumentQuery
impl Serialize for DocumentQuery
source§impl TransportRequest for DocumentQuery
impl TransportRequest for DocumentQuery
§type Client = <GetDocumentsRequest as TransportRequest>::Client
type Client = <GetDocumentsRequest as TransportRequest>::Client
§type Response = <GetDocumentsRequest as TransportRequest>::Response
type Response = <GetDocumentsRequest as TransportRequest>::Response
source§const SETTINGS_OVERRIDES: RequestSettings = <GetDocumentsRequest as TransportRequest>::SETTINGS_OVERRIDES
const SETTINGS_OVERRIDES: RequestSettings = <GetDocumentsRequest as TransportRequest>::SETTINGS_OVERRIDES
source§fn request_name(&self) -> &'static str
fn request_name(&self) -> &'static str
source§fn method_name(&self) -> &'static str
fn method_name(&self) -> &'static str
source§fn execute_transport<'c>(
self,
client: &'c mut Self::Client,
settings: &AppliedRequestSettings,
) -> BoxFuture<'c, Result<Self::Response, <Self::Client as TransportClient>::Error>>
fn execute_transport<'c>( self, client: &'c mut Self::Client, settings: &AppliedRequestSettings, ) -> BoxFuture<'c, Result<Self::Response, <Self::Client as TransportClient>::Error>>
§fn response_name(&self) -> &'static str
fn response_name(&self) -> &'static str
source§impl<'a> TryFrom<&'a DocumentQuery> for DriveDocumentQuery<'a>
impl<'a> TryFrom<&'a DocumentQuery> for DriveDocumentQuery<'a>
source§impl TryFrom<DocumentQuery> for GetDocumentsRequest
impl TryFrom<DocumentQuery> for GetDocumentsRequest
Auto Trait Implementations§
impl Freeze for DocumentQuery
impl RefUnwindSafe for DocumentQuery
impl Send for DocumentQuery
impl Sync for DocumentQuery
impl Unpin for DocumentQuery
impl UnwindSafe for DocumentQuery
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> CostsExt for T
impl<T> CostsExt for T
§fn wrap_with_cost(self, cost: OperationCost) -> CostContext<Self>where
Self: Sized,
fn wrap_with_cost(self, cost: OperationCost) -> CostContext<Self>where
Self: Sized,
CostContext
object with provided costs.§fn wrap_fn_cost(
self,
f: impl FnOnce(&Self) -> OperationCost,
) -> CostContext<Self>where
Self: Sized,
fn wrap_fn_cost(
self,
f: impl FnOnce(&Self) -> OperationCost,
) -> CostContext<Self>where
Self: Sized,
CostContext
object with costs computed using the
value getting wrapped.§impl<T> DapiRequest for Twhere
T: TransportRequest + Send,
impl<T> DapiRequest for Twhere
T: TransportRequest + Send,
§type TransportError = <<T as TransportRequest>::Client as TransportClient>::Error
type TransportError = <<T as TransportRequest>::Client as TransportClient>::Error
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.