pub struct QueryV2<Args> { /* private fields */ }Expand description
A DQL query string with its arguments
Most APIs in the Ditto SDK don’t take a QueryV2 directly, but instead take a generic
parameter that implements IntoQuery, a trait implemented by types that can be turned into a
QueryV2.
Common examples are:
String(and string-like types)(String, Args)whereArgsis anything that implementsSerialize
let select_query = "SELECT * FROM cars".into_query();
let insert_query = (
"INSERT INTO cars DOCUMENTS (:doc)",
json!({"doc": {"foo": "bar"}}),
).into_query();§The Args type
This type is generic over its arguments, with the requirement that the arguments must:
- implement
Serialize - serialize to a map-like type (e.g.
serde_json::json!({"some": "object"})orHashMap, not aString)
If the arguments are mutated using interior mutability, the result is not specified and may
cause logic errors. Note that this is not undefined behaviour, since any errors will
be confined to this instance of QueryV2.
When no arguments are provided, the Args type defaults to ()
Trait Implementations§
impl<Args> StructuralPartialEq for QueryV2<Args>
Auto Trait Implementations§
impl<Args> Freeze for QueryV2<Args>where
Args: Freeze,
impl<Args> RefUnwindSafe for QueryV2<Args>where
Args: RefUnwindSafe,
impl<Args> Send for QueryV2<Args>where
Args: Send,
impl<Args> Sync for QueryV2<Args>where
Args: Sync,
impl<Args> Unpin for QueryV2<Args>where
Args: Unpin,
impl<Args> UnwindSafe for QueryV2<Args>where
Args: 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