pub struct Query {
pub logical_name: &'static str,
pub limit: Option<u32>,
pub filter: Option<Filter>,
pub order: Option<Vec<Order>>,
}
Expand description
Represents a Microsoft Dataverse query
These queries are modeled after the ODATAv4 specifications used by Microsoft Dataverse. This section is prone to change as these specifications allow for a wide array of possible querying options.
§Examples
use uuid::Uuid;
use serde::Deserialize;
use powerplatform_dataverse_service_client::{
client::{Client, Page},
entity::ReadEntity,
result::Result,
select::Select,
query::{
attribute::Attribute,
filter::Filter,
order::Order,
Query
}
};
async fn test() -> Result<()> {
let query = Query::new("contacts")
.limit(3)
.filter(Filter::Equal("firstname", Attribute::String(String::from("Testy"))))
.order(vec![Order::Ascending("lastname")]);
let client = Client::new_dummy();
let contacts: Page<Contact> = client.retrieve_multiple(&query).await?;
Ok(())
}
#[derive(Deserialize)]
struct Contact {
contactid: Uuid,
firstname: String,
lastname: String,
}
impl ReadEntity for Contact {}
impl Select for Contact {
fn get_columns() -> &'static [&'static str] {
&["contactid", "firstname", "lastname"]
}
}
Fields§
§logical_name: &'static str
§limit: Option<u32>
§filter: Option<Filter>
§order: Option<Vec<Order>>
Implementations§
Source§impl Query
impl Query
Sourcepub fn new(logical_name: &'static str) -> Self
pub fn new(logical_name: &'static str) -> Self
Creates a new empty query for the given table
Please note that though it is possible to execute this empty query directly, this will attempt to retrieve every single entity record from the table.
Use the limit(...)
and filter(...)
functions to add a limiting factor to your query
of you don’t want this
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Query
impl RefUnwindSafe for Query
impl Send for Query
impl Sync for Query
impl Unpin for Query
impl UnwindSafe for Query
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.