pub struct ArangoQuery { /* private fields */ }
Implementations§
Source§impl ArangoQuery
impl ArangoQuery
Sourcepub fn with_bind_vars(query: &str, bind_vars: BTreeMap<String, Value>) -> Self
pub fn with_bind_vars(query: &str, bind_vars: BTreeMap<String, Value>) -> Self
Same as raw, but with &str
Sourcepub fn raw(query: String, bind_vars: BTreeMap<String, Value>) -> Self
pub fn raw(query: String, bind_vars: BTreeMap<String, Value>) -> Self
ⓘ
let mut bind_vars = std::collections::BTreeMap::new();
bind_vars.insert(
"@conactcoll".to_owned(),
serde_json::Value::String(conactcoll.clone()),
);
bind_vars.insert("email".to_owned(), serde_json::Value::String("aaa@bbb.ccc"));
let raw_query = "FOR c IN @@conactcoll FOR b IN @@balancecoll FILTER c.email == @email RETURN b";
let query = ArangoQuery::raw(raw_query.to_owned(), bind_vars);
match query.try_exec::<CreditBalance>(&conn).await {
Ok(ar) => ar.result,
Err(_) => vec![],
}
Sourcepub fn raw_batched(
query: String,
bind_vars: BTreeMap<String, Value>,
batch_size: usize,
) -> Self
pub fn raw_batched( query: String, bind_vars: BTreeMap<String, Value>, batch_size: usize, ) -> Self
Returns results in batches of size batch_size
ⓘ
let query = ArangoQuery::raw_batched(raw_query.to_owned(), bind_vars, 100);
Sourcepub fn into_batched(self, batch_size: usize) -> Self
pub fn into_batched(self, batch_size: usize) -> Self
Converts an existing query to batched
of size batch_size
.
Sourcepub fn full_count(self, full_count: bool) -> Self
pub fn full_count(self, full_count: bool) -> Self
Enables fullCount
in the query stats of an existing query.
Sourcepub fn try_exec<T: Serialize + DeserializeOwned>(
&self,
dbc: &ArangoConnection,
) -> impl Future<Output = Result<ArangoResponse<T>, Error>>
pub fn try_exec<T: Serialize + DeserializeOwned>( &self, dbc: &ArangoConnection, ) -> impl Future<Output = Result<ArangoResponse<T>, Error>>
Executes this query using the provided ArangoConnection
.
Returns ArangoResponse
§Errors
Returns reqwest::Error
Note: reqwest::Error
is temporarily exposed and may change in the future.
Trait Implementations§
Source§impl Debug for ArangoQuery
impl Debug for ArangoQuery
Source§impl Default for ArangoQuery
impl Default for ArangoQuery
Source§fn default() -> ArangoQuery
fn default() -> ArangoQuery
Returns the “default value” for a type. Read more
Source§impl From<ArangoQuery> for Body
impl From<ArangoQuery> for Body
Source§fn from(item: ArangoQuery) -> Self
fn from(item: ArangoQuery) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ArangoQuery
impl PartialEq for ArangoQuery
Source§impl Serialize for ArangoQuery
impl Serialize for ArangoQuery
impl StructuralPartialEq for ArangoQuery
Auto Trait Implementations§
impl Freeze for ArangoQuery
impl RefUnwindSafe for ArangoQuery
impl Send for ArangoQuery
impl Sync for ArangoQuery
impl Unpin for ArangoQuery
impl UnwindSafe for ArangoQuery
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