mod aggregate;
mod bind;
mod compute;
mod current_value_source;
mod distinct;
mod explain;
mod expr;
pub(crate) mod fetch;
mod filter;
mod foreach;
mod graph;
mod ifelse;
mod info;
mod join;
mod knn_topk;
mod let_plan;
mod limit;
#[cfg(feature = "gql")]
mod mutate;
mod project;
mod project_value;
pub(crate) mod recursion;
mod r#return;
pub(crate) mod scan;
mod sequence;
mod sleep;
mod sort;
mod source_expr;
mod split;
mod timeout;
mod union;
mod unwrap_exactly_one;
mod version_scope;
#[cfg(test)]
pub(crate) mod test_util;
pub use aggregate::{
Aggregate, AggregateExprInfo, AggregateField, ExtractedAggregate, aggregate_field_name,
};
#[cfg_attr(not(feature = "gql"), allow(unused_imports))]
pub use bind::Bind;
pub use compute::Compute;
pub use current_value_source::CurrentValueSource;
#[cfg_attr(not(feature = "gql"), allow(unused_imports))]
pub use distinct::Distinct;
pub use explain::{AnalyzePlan, ExplainPlan};
pub use expr::ExprPlan;
pub use fetch::Fetch;
pub(crate) use fetch::FetchStep;
pub use filter::Filter;
pub use foreach::ForeachPlan;
#[cfg_attr(not(feature = "gql"), allow(unused_imports))]
pub use graph::{
DistinctEdges, EdgeBinding, EndpointBind, EndpointField, Expand, ExpandDir, PathExpand,
PathMode, ShortestPathExpand, ShortestSelector,
};
pub use ifelse::IfElsePlan;
pub use info::{
DatabaseInfoPlan, IndexInfoPlan, NamespaceInfoPlan, RootInfoPlan, TableInfoPlan, UserInfoPlan,
};
#[cfg_attr(not(feature = "gql"), allow(unused_imports))]
pub use join::{HashJoin, JoinType};
pub use knn_topk::KnnTopK;
pub use let_plan::LetPlan;
pub use limit::Limit;
#[cfg(feature = "gql")]
pub use mutate::{DeleteBinding, DrainSink, InsertGraph, SingleRowScan, UpdateBinding};
#[cfg(feature = "gql")]
pub(crate) use mutate::{InsertEdgeOp, InsertNodeOp};
pub use project::{FieldSelection, Project, Projection, SelectProject};
pub use project_value::ProjectValue;
pub use recursion::RecursionOp;
pub use r#return::ReturnPlan;
pub use scan::CountScan;
pub use scan::{
DynamicScan, EdgeTableSpec, EmptyScan, FullTextScan, GraphEdgeScan, GraphScanOutput, IndexScan,
KnnScan, RecordIdScan, ReferenceScan, ReferenceScanOutput, TableScan, UnionIndexScan,
};
pub use sequence::SequencePlan;
pub use sleep::SleepPlan;
#[cfg(all(storage, not(target_family = "wasm")))]
pub use sort::{ExternalSort, ExternalSortByKey};
pub use sort::{
OrderByField, RandomShuffle, Sort, SortByKey, SortDirection, SortKey, SortTopK, SortTopKByKey,
compare_values,
};
pub use source_expr::SourceExpr;
pub use split::Split;
pub use timeout::Timeout;
pub use union::Union;
pub use unwrap_exactly_one::UnwrapExactlyOne;
pub use version_scope::VersionScope;
use crate::exec::{ExecutionContext, FlowResult};
#[inline]
#[cfg_attr(not(feature = "gql"), allow(dead_code))]
pub(crate) fn check_cancelled(ctx: &ExecutionContext) -> FlowResult<()> {
if ctx.cancellation().is_cancelled() {
return Err(crate::expr::ControlFlow::Err(anyhow::anyhow!(
crate::err::Error::QueryCancelled
)));
}
Ok(())
}
#[cfg_attr(not(feature = "gql"), allow(dead_code))]
pub(crate) fn binding_record_id(
row: &crate::val::Value,
name: &str,
) -> Option<crate::val::RecordId> {
let crate::val::Value::Object(obj) = row else {
return None;
};
match obj.get(name) {
Some(crate::val::Value::Object(node)) => match node.get("id") {
Some(crate::val::Value::RecordId(rid)) => Some(rid.clone()),
_ => None,
},
Some(crate::val::Value::RecordId(rid)) => Some(rid.clone()),
_ => None,
}
}
#[cfg_attr(not(feature = "gql"), allow(dead_code))]
pub(crate) fn gql_output_rows_exceeded(max_rows: usize) -> crate::expr::ControlFlow {
crate::expr::ControlFlow::Err(anyhow::anyhow!(crate::err::Error::InvalidStatement(format!(
"GQL MATCH fan-out exceeded the maximum of {max_rows} output rows \
(configurable via SURREAL_GQL_MAX_OUTPUT_ROWS)"
))))
}