pub struct QueryRequest<'hlx, 'a, R> { /* private fields */ }Expand description
A fully addressed request, ready to send.
Produced once a query kind has been chosen via QueryBuilder::stored or
QueryBuilder::dynamic; the only remaining step is send().
Implementations§
Source§impl<'hlx, 'a, R: for<'de> Deserialize<'de>> QueryRequest<'hlx, 'a, R>
impl<'hlx, 'a, R: for<'de> Deserialize<'de>> QueryRequest<'hlx, 'a, R>
Sourcepub async fn send(self) -> Result<R, HelixError>
pub async fn send(self) -> Result<R, HelixError>
Send the request and deserialize the response body into R.
Resolves the route (/v1/query for dynamic, /v1/query/<name> for
stored), applies the toggled headers and bearer API key, attaches the
body, and awaits the response.
§Errors
HelixError::ReqwestErrorfor transport failures.HelixError::RemoteErrorfor any non-200response (carrying the server’s body or status reason).HelixError::SerializationErrorif the request payload cannot be serialized or the response body cannot be deserialized intoR.
§Examples
use helix_db::Client;
use helix_db::dsl::prelude::*;
use serde::Deserialize;
#[derive(Deserialize)]
struct AddUserResponse { user_id: u64 }
let response: AddUserResponse = client.query().dynamic(request).send().await?;Auto Trait Implementations§
impl<'hlx, 'a, R> !RefUnwindSafe for QueryRequest<'hlx, 'a, R>
impl<'hlx, 'a, R> !UnwindSafe for QueryRequest<'hlx, 'a, R>
impl<'hlx, 'a, R> Freeze for QueryRequest<'hlx, 'a, R>
impl<'hlx, 'a, R> Send for QueryRequest<'hlx, 'a, R>where
R: Send,
impl<'hlx, 'a, R> Sync for QueryRequest<'hlx, 'a, R>where
R: Sync,
impl<'hlx, 'a, R> Unpin for QueryRequest<'hlx, 'a, R>where
R: Unpin,
impl<'hlx, 'a, R> UnsafeUnpin for QueryRequest<'hlx, 'a, R>
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