pub struct Query {
pub attrs: Attrs,
pub sources: Vec<Source>,
pub predicate: Option<Expr>,
pub group_by: Option<Expr>,
pub order_by: Option<OrderBy>,
pub limit: Option<Limit>,
pub projection: Expr,
}Expand description
A complete EventQL query.
This is the root node of the AST, representing a full query with all its clauses. A query must have at least one source and a projection; other clauses are optional.
§Structure
FROM <sources>
[WHERE <predicate>]
[GROUP BY <expr>]
[ORDER BY <expr> ASC|DESC]
[TOP|SKIP <n>]
PROJECT INTO <projection>§Examples
use eventql_parser::parse_query;
let query = parse_query(
"FROM e IN events \
WHERE e.price > 100 \
ORDER BY e.timestamp DESC \
TOP 10 \
PROJECT INTO {id: e.id, price: e.price}"
).unwrap();
assert_eq!(query.sources.len(), 1);
assert!(query.predicate.is_some());
assert!(query.order_by.is_some());
assert!(query.limit.is_some());Fields§
§attrs: AttrsMetadata about this query
sources: Vec<Source>FROM clause sources (must have at least one)
predicate: Option<Expr>Optional WHERE clause filter predicate
group_by: Option<Expr>Optional GROUP BY clause expression
order_by: Option<OrderBy>Optional ORDER BY clause
limit: Option<Limit>Optional LIMIT clause (TOP or SKIP)
projection: ExprPROJECT INTO clause expression (required)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Query
impl RefUnwindSafe for Query
impl Send for Query
impl Sync for Query
impl Unpin 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
Mutably borrows from an owned value. Read more