pub struct Query { /* private fields */ }Expand description
An immutable Datalog query value.
Start from one of the find* constructors, chain :in and :where
builders, and render with Query::to_edn. The query shape
(relation/collection/tuple/scalar) is fixed by which constructor is used
and determines the shape of the crate::QueryResult.
Implementations§
Source§impl Query
impl Query
Sourcepub fn find<E: Into<FindElem>>(elems: impl IntoIterator<Item = E>) -> Self
pub fn find<E: Into<FindElem>>(elems: impl IntoIterator<Item = E>) -> Self
A relation query :find ?a ?b yielding a set of tuples.
Sourcepub fn find_rel(elems: Vec<FindElem>) -> Self
pub fn find_rel(elems: Vec<FindElem>) -> Self
A relation query from an explicit list of find elements. Use this when mixing element kinds, e.g. a variable and a pull expression.
Sourcepub fn find_coll(elem: impl Into<FindElem>) -> Self
pub fn find_coll(elem: impl Into<FindElem>) -> Self
A collection query :find [?x ...] yielding a flat list of values.
Sourcepub fn find_tuple<E: Into<FindElem>>(elems: impl IntoIterator<Item = E>) -> Self
pub fn find_tuple<E: Into<FindElem>>(elems: impl IntoIterator<Item = E>) -> Self
A tuple query :find [?a ?b] yielding a single tuple.
Sourcepub fn find_scalar(elem: impl Into<FindElem>) -> Self
pub fn find_scalar(elem: impl Into<FindElem>) -> Self
A scalar query :find ?x . yielding a single value.
Sourcepub fn with(self, vars: impl IntoIterator<Item = Var>) -> Self
pub fn with(self, vars: impl IntoIterator<Item = Var>) -> Self
Adds :with grouping variables (kept out of :find but preserved for
aggregate cardinality).
Sourcepub fn in_db(self, name: impl Into<String>) -> Self
pub fn in_db(self, name: impl Into<String>) -> Self
Declares an additional database source input such as $hist, bound
positionally after the default $.
Sourcepub fn where_(self, clause: impl Into<Clause>) -> Self
pub fn where_(self, clause: impl Into<Clause>) -> Self
Adds the first :where clause (or another one; identical to
Query::and).
Sourcepub fn has_inputs(&self) -> bool
pub fn has_inputs(&self) -> bool
Whether this query declares any non-database :in inputs (rules,
scalars, tuples, collections, or relations), which the caller must
supply as arguments.
Trait Implementations§
impl Eq for Query
impl StructuralPartialEq for Query
Auto Trait Implementations§
impl Freeze for Query
impl RefUnwindSafe for Query
impl Send for Query
impl Sync for Query
impl Unpin for Query
impl UnsafeUnpin for Query
impl UnwindSafe for Query
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request