pub struct QueryBuilder<'a> { /* private fields */ }
Implementations§
Source§impl<'a> QueryBuilder<'a>
impl<'a> QueryBuilder<'a>
pub fn new(client: &'a Client<'_>) -> QueryBuilder<'a>
Sourcepub fn order_by(&self, field: &'a str) -> QueryBuilder<'_>
pub fn order_by(&self, field: &'a str) -> QueryBuilder<'_>
Set the field for sorting.
Sourcepub fn desc(&self) -> QueryBuilder<'_>
pub fn desc(&self) -> QueryBuilder<'_>
Set reverse order. Use this with order_by
method.
Sourcepub fn limit(&self, limit: u32) -> QueryBuilder<'_>
pub fn limit(&self, limit: u32) -> QueryBuilder<'_>
Limit the number of records of query result.
Sourcepub fn skip(&self, skip: u32) -> QueryBuilder<'_>
pub fn skip(&self, skip: u32) -> QueryBuilder<'_>
Specify the number of records to skip.
Sourcepub fn filter_by<T: Display>(&self, format: &str, value: T) -> QueryBuilder<'_>
pub fn filter_by<T: Display>(&self, format: &str, value: T) -> QueryBuilder<'_>
Set filter option, whkch is mapped q
parameter in REST API.
Sourcepub fn and<T: Display>(&self, format: &str, value: T) -> QueryBuilder<'_>
pub fn and<T: Display>(&self, format: &str, value: T) -> QueryBuilder<'_>
Alias of filter_by
.
Sourcepub fn id<T>(&self, id: &str) -> Result<(T, Meta)>where
T: DeserializeOwned,
pub fn id<T>(&self, id: &str) -> Result<(T, Meta)>where
T: DeserializeOwned,
Get a single record by id.
Sourcepub fn all<T>(&self) -> Result<Vec<(T, Meta)>>where
T: DeserializeOwned,
pub fn all<T>(&self) -> Result<Vec<(T, Meta)>>where
T: DeserializeOwned,
Get all records with default query parameters.
Sourcepub fn run<T>(&self) -> Result<Vec<(T, Meta)>>where
T: DeserializeOwned,
pub fn run<T>(&self) -> Result<Vec<(T, Meta)>>where
T: DeserializeOwned,
Run query with configured query parameters.
Auto Trait Implementations§
impl<'a> Freeze for QueryBuilder<'a>
impl<'a> RefUnwindSafe for QueryBuilder<'a>
impl<'a> Send for QueryBuilder<'a>
impl<'a> Sync for QueryBuilder<'a>
impl<'a> Unpin for QueryBuilder<'a>
impl<'a> UnwindSafe for QueryBuilder<'a>
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> 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>
Converts
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>
Converts
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 more