mod base_table;
pub(crate) use base_table::*;
mod coll;
pub(crate) use coll::*;
mod control_flow;
pub(crate) use control_flow::*;
mod data_types;
pub(crate) use data_types::*;
mod datetime;
pub(crate) use datetime::*;
mod strings;
pub(crate) use strings::*;
mod path;
pub(crate) use path::*;
mod pattern_match;
pub(crate) use pattern_match::*;
mod operators;
pub(crate) use operators::*;
use crate::eval::EvalContext;
use partiql_value::{Tuple, Value};
use std::borrow::Cow;
use std::fmt::Debug;
use thiserror::Error;
pub trait EvalExpr: Debug {
fn evaluate<'a>(&'a self, bindings: &'a Tuple, ctx: &'a dyn EvalContext) -> Cow<'a, Value>;
}
#[derive(Error, Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum BindError {
#[error("Argument number mismatch: expected one of `{expected:?}`, found `{found}` ")]
ArgNumMismatch { expected: Vec<usize>, found: usize },
#[error("Argument constraint not satisfied: `{0}`")]
ArgumentConstraint(String),
#[error("Not yet implemented: {0}")]
NotYetImplemented(String),
#[error("Bind error: unknown error")]
Unknown,
}
pub trait BindEvalExpr: Debug {
fn bind<const STRICT: bool>(
&self,
args: Vec<Box<dyn EvalExpr>>,
) -> Result<Box<dyn EvalExpr>, BindError>;
}