Skip to main content

linkrs_query/binder/bound/
clause.rs

1use super::expr::BoundExpression;
2
3use crate::parser::ast::{LimitClause, SampleClause, SkipClause};
4use linkrs_core::types::OrderDirection;
5
6/// A unified projection item used by RETURN, YIELD, WITH, and COLLECT clauses.
7///
8/// Previously `BoundReturnItem` and `BoundYieldItem` existed as identical
9/// separate structs; they have been merged into this single type.
10#[derive(Debug, Clone)]
11pub struct BoundProjectionItem {
12    pub expression: BoundExpression,
13    pub alias: Option<String>,
14}
15
16/// Backward-compatible alias for [`BoundProjectionItem`].
17pub type BoundReturnItem = BoundProjectionItem;
18/// Backward-compatible alias for [`BoundProjectionItem`].
19pub type BoundYieldItem = BoundProjectionItem;
20
21#[derive(Debug, Clone)]
22pub struct BoundOrderByItem {
23    pub expression: BoundExpression,
24    pub direction: OrderDirection,
25}
26
27#[derive(Debug, Clone)]
28pub struct BoundReturnClause {
29    pub items: Vec<BoundProjectionItem>,
30    pub distinct: bool,
31    pub order_by: Option<Vec<BoundOrderByItem>>,
32    pub limit: Option<LimitClause>,
33    pub skip: Option<SkipClause>,
34    pub sample: Option<SampleClause>,
35}
36
37#[derive(Debug, Clone)]
38pub struct BoundYieldClause {
39    pub items: Vec<BoundProjectionItem>,
40    pub distinct: bool,
41    pub order_by: Option<Vec<BoundOrderByItem>>,
42    pub limit: Option<LimitClause>,
43    pub skip: Option<SkipClause>,
44}
45
46#[derive(Debug, Clone)]
47pub struct BoundWhereClause {
48    pub condition: BoundExpression,
49}
50
51#[derive(Debug, Clone)]
52pub struct BoundWithClause {
53    pub items: Vec<BoundProjectionItem>,
54    pub condition: Option<BoundExpression>,
55}