pub struct ApiQuerySet<T> { /* private fields */ }Expand description
A QuerySet-like builder for API requests.
This provides a fluent interface similar to Django’s QuerySet for building and executing API queries.
Implementations§
Source§impl<T> ApiQuerySet<T>where
T: Serialize + DeserializeOwned,
impl<T> ApiQuerySet<T>where
T: Serialize + DeserializeOwned,
Sourcepub fn filter_op(
self,
field: impl Into<String>,
op: FilterOp,
value: impl Serialize,
) -> Self
pub fn filter_op( self, field: impl Into<String>, op: FilterOp, value: impl Serialize, ) -> Self
Sourcepub async fn all(&self) -> Result<Vec<T>, ServerFnError>
pub async fn all(&self) -> Result<Vec<T>, ServerFnError>
Fetches all matching results (non-WASM stub).
Sourcepub async fn first(&self) -> Result<Option<T>, ServerFnError>
pub async fn first(&self) -> Result<Option<T>, ServerFnError>
Fetches the first matching result (non-WASM stub).
Sourcepub async fn get(&self, _pk: impl Display) -> Result<T, ServerFnError>
pub async fn get(&self, _pk: impl Display) -> Result<T, ServerFnError>
Fetches a single result by primary key (non-WASM stub).
Sourcepub async fn count(&self) -> Result<usize, ServerFnError>
pub async fn count(&self) -> Result<usize, ServerFnError>
Returns the count of matching results (non-WASM stub).
Sourcepub async fn exists(&self) -> Result<bool, ServerFnError>where
Self: Clone,
pub async fn exists(&self) -> Result<bool, ServerFnError>where
Self: Clone,
Checks if any matching results exist.
Sourcepub async fn create(&self, _data: &T) -> Result<T, ServerFnError>
pub async fn create(&self, _data: &T) -> Result<T, ServerFnError>
Creates a new record (non-WASM stub).
Sourcepub async fn update(
&self,
_pk: impl Display,
_data: &T,
) -> Result<T, ServerFnError>
pub async fn update( &self, _pk: impl Display, _data: &T, ) -> Result<T, ServerFnError>
Updates an existing record (non-WASM stub).
Sourcepub async fn partial_update(
&self,
_pk: impl Display,
_data: &Value,
) -> Result<T, ServerFnError>
pub async fn partial_update( &self, _pk: impl Display, _data: &Value, ) -> Result<T, ServerFnError>
Partially updates an existing record (non-WASM stub).
Trait Implementations§
Source§impl<T: Clone> Clone for ApiQuerySet<T>
impl<T: Clone> Clone for ApiQuerySet<T>
Source§fn clone(&self) -> ApiQuerySet<T>
fn clone(&self) -> ApiQuerySet<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<T> Freeze for ApiQuerySet<T>
impl<T> RefUnwindSafe for ApiQuerySet<T>where
T: RefUnwindSafe,
impl<T> Send for ApiQuerySet<T>where
T: Send,
impl<T> Sync for ApiQuerySet<T>where
T: Sync,
impl<T> Unpin for ApiQuerySet<T>where
T: Unpin,
impl<T> UnsafeUnpin for ApiQuerySet<T>
impl<T> UnwindSafe for ApiQuerySet<T>where
T: UnwindSafe,
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> 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