use indexmap::IndexMap;
use rust_decimal::Decimal as RustDecimal;
use std::fmt;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use partiql_ast_macros::Visit;
pub type AstTypeMap<T> = IndexMap<NodeId, T>;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct NodeId(pub u32);
#[derive(Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct AstNode<T> {
pub id: NodeId,
pub node: T,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum Item {
Ddl(Ddl),
Dml(Dml),
Query(Query),
}
impl fmt::Display for Item {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{self:?}")
}
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Ddl {
pub op: DdlOp,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum DdlOp {
CreateTable(CreateTable),
DropTable(DropTable),
CreateIndex(CreateIndex),
DropIndex(DropIndex),
}
#[derive(Visit, Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct CreateTable {
#[visit(skip)]
pub table_name: SymbolPrimitive,
}
#[derive(Visit, Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct DropTable {
#[visit(skip)]
pub table_name: SymbolPrimitive,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct CreateIndex {
#[visit(skip)]
pub index_name: SymbolPrimitive,
pub fields: Vec<Box<Expr>>,
}
#[derive(Visit, Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct DropIndex {
#[visit(skip)]
pub table: SymbolPrimitive,
#[visit(skip)]
pub keys: SymbolPrimitive,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Dml {
pub op: DmlOp,
pub from_clause: Option<FromClause>,
pub where_clause: Option<Box<Expr>>,
pub returning: Option<ReturningExpr>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum DmlOp {
Insert(Insert),
InsertValue(InsertValue),
Set(Set),
Remove(Remove),
Delete(Delete),
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct ReturningExpr {
pub elems: Vec<ReturningElem>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct ReturningElem {
#[visit(skip)]
pub mapping: ReturningMapping,
#[visit(skip)]
pub column: ColumnComponent,
}
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum ColumnComponent {
ReturningWildcard,
ReturningColumn(ReturningColumn),
}
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct ReturningColumn {
pub expr: Box<Expr>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum ReturningMapping {
ModifiedNew,
ModifiedOld,
AllNew,
AllOld,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Insert {
pub target: Box<Expr>,
pub values: Box<Expr>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct InsertValue {
pub target: Box<Expr>,
pub value: Box<Expr>,
pub index: Option<Box<Expr>>,
pub on_conflict: Option<OnConflict>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Set {
pub assignment: Assignment,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Assignment {
pub target: Box<Expr>,
pub value: Box<Expr>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Remove {
pub target: Box<Expr>,
}
#[derive(Visit, Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Delete {}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct OnConflict {
pub expr: Box<Expr>,
#[visit(skip)]
pub conflict_action: ConflictAction,
}
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum ConflictAction {
DoNothing,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct TopLevelQuery {
pub with: Option<AstNode<WithClause>>,
pub query: AstNode<Query>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Query {
pub set: AstNode<QuerySet>,
pub order_by: Option<Box<AstNode<OrderByExpr>>>,
pub limit_offset: Option<Box<AstNode<LimitOffsetClause>>>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct WithClause {
#[visit(skip)]
pub recursive: bool,
pub withs: Vec<AstNode<WithElement>>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct WithElement {
#[visit(skip)]
pub query_name: SymbolPrimitive,
#[visit(skip)]
pub columns: Option<Vec<SymbolPrimitive>>,
pub subquery: AstNode<Expr>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum QuerySet {
BagOp(Box<AstNode<BagOpExpr>>),
Select(Box<AstNode<Select>>),
Expr(Box<Expr>),
Values(Vec<Box<Expr>>),
Table(QueryTable),
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct BagOpExpr {
#[visit(skip)]
pub bag_op: BagOperator,
#[visit(skip)]
pub setq: SetQuantifier,
pub lhs: Box<AstNode<Query>>,
pub rhs: Box<AstNode<Query>>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum BagOperator {
Union,
Except,
Intersect,
OuterUnion,
OuterExcept,
OuterIntersect,
}
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum SetQuantifier {
All,
Distinct,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Select {
pub project: AstNode<Projection>,
pub from: Option<AstNode<FromClause>>,
pub from_let: Option<AstNode<Let>>,
pub where_clause: Option<Box<AstNode<WhereClause>>>,
pub group_by: Option<Box<AstNode<GroupByExpr>>>,
pub having: Option<Box<AstNode<HavingClause>>>,
}
#[derive(Visit, Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct QueryTable {
#[visit(skip)]
pub table_name: SymbolPrimitive,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Projection {
pub kind: ProjectionKind,
#[visit(skip)]
pub setq: Option<SetQuantifier>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum ProjectionKind {
#[visit(skip)]
ProjectStar,
ProjectList(Vec<AstNode<ProjectItem>>),
ProjectPivot(ProjectPivot),
ProjectValue(Box<Expr>),
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum ProjectItem {
ProjectAll(ProjectAll), ProjectExpr(ProjectExpr),
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct ProjectPivot {
pub key: Box<Expr>,
pub value: Box<Expr>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct ProjectAll {
pub expr: Box<Expr>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct ProjectExpr {
pub expr: Box<Expr>,
#[visit(skip)]
pub as_alias: Option<SymbolPrimitive>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum Expr {
Lit(AstNode<Lit>),
VarRef(AstNode<VarRef>),
BinOp(AstNode<BinOp>),
UniOp(AstNode<UniOp>),
Like(AstNode<Like>),
Between(AstNode<Between>),
In(AstNode<In>),
Case(AstNode<Case>),
Struct(AstNode<Struct>),
Bag(AstNode<Bag>),
List(AstNode<List>),
Sexp(AstNode<Sexp>),
Path(AstNode<Path>),
Call(AstNode<Call>),
CallAgg(AstNode<CallAgg>),
Query(AstNode<Query>),
#[visit(skip)]
Error,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[visit(skip_recurse)]
pub enum Lit {
#[visit(skip)]
Null,
#[visit(skip)]
Missing,
#[visit(skip)]
Int8Lit(i8),
#[visit(skip)]
Int16Lit(i16),
#[visit(skip)]
Int32Lit(i32),
#[visit(skip)]
Int64Lit(i64),
#[visit(skip)]
DecimalLit(RustDecimal),
#[visit(skip)]
NumericLit(RustDecimal),
#[visit(skip)]
RealLit(f32),
#[visit(skip)]
FloatLit(f32),
#[visit(skip)]
DoubleLit(f64),
#[visit(skip)]
BoolLit(bool),
#[visit(skip)]
IonStringLit(String),
#[visit(skip)]
CharStringLit(String),
#[visit(skip)]
NationalCharStringLit(String),
#[visit(skip)]
BitStringLit(String),
#[visit(skip)]
HexStringLit(String),
#[visit(skip)]
StructLit(AstNode<Struct>),
#[visit(skip)]
BagLit(AstNode<Bag>),
#[visit(skip)]
ListLit(AstNode<List>),
#[visit(skip)]
TypedLit(String, Type),
}
#[derive(Visit, Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct VarRef {
#[visit(skip)]
pub name: SymbolPrimitive,
#[visit(skip)]
pub qualifier: ScopeQualifier,
}
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum ScopeQualifier {
Unqualified,
Qualified,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct BinOp {
#[visit(skip)]
pub kind: BinOpKind,
pub lhs: Box<Expr>,
pub rhs: Box<Expr>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum BinOpKind {
Add,
Div,
Exp,
Mod,
Mul,
Sub,
And,
Or,
Concat,
Eq,
Gt,
Gte,
Lt,
Lte,
Ne,
Is,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct UniOp {
#[visit(skip)]
pub kind: UniOpKind,
pub expr: Box<Expr>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum UniOpKind {
Pos,
Neg,
Not,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Like {
pub value: Box<Expr>,
pub pattern: Box<Expr>,
pub escape: Option<Box<Expr>>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Between {
pub value: Box<Expr>,
pub from: Box<Expr>,
pub to: Box<Expr>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct In {
pub lhs: Box<Expr>,
pub rhs: Box<Expr>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum Case {
SimpleCase(SimpleCase),
SearchedCase(SearchedCase),
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct SimpleCase {
pub expr: Box<Expr>,
pub cases: Vec<ExprPair>,
pub default: Option<Box<Expr>>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct SearchedCase {
pub cases: Vec<ExprPair>,
pub default: Option<Box<Expr>>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct ExprPair {
pub first: Box<Expr>,
pub second: Box<Expr>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Struct {
pub fields: Vec<ExprPair>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Bag {
pub values: Vec<Box<Expr>>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct List {
pub values: Vec<Box<Expr>>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Sexp {
pub values: Vec<Box<Expr>>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct CallAgg {
#[visit(skip)]
pub func_name: SymbolPrimitive,
pub args: Vec<AstNode<CallArg>>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Call {
#[visit(skip)]
pub func_name: SymbolPrimitive,
pub args: Vec<AstNode<CallArg>>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum CallArg {
#[visit(skip)]
Star(),
Positional(Box<Expr>),
#[visit(skip)]
PositionalType(Type),
Named(CallArgNamed),
NamedType(CallArgNamedType),
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct CallArgNamed {
#[visit(skip)]
pub name: SymbolPrimitive,
pub value: Box<Expr>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct CallArgNamedType {
#[visit(skip)]
pub name: SymbolPrimitive,
#[visit(skip)]
pub ty: Type,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Path {
pub root: Box<Expr>,
pub steps: Vec<PathStep>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum PathStep {
PathExpr(PathExpr),
#[visit(skip)]
PathWildCard,
#[visit(skip)]
PathUnpivot,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct PathExpr {
pub index: Box<Expr>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Let {
pub let_bindings: Vec<LetBinding>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct LetBinding {
pub expr: Box<Expr>,
#[visit(skip)]
pub as_alias: SymbolPrimitive,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct FromClause {
pub source: FromSource,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum FromSource {
FromLet(AstNode<FromLet>),
Join(AstNode<Join>),
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct WhereClause {
pub expr: Box<Expr>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct HavingClause {
pub expr: Box<Expr>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct FromLet {
pub expr: Box<Expr>,
#[visit(skip)]
pub kind: FromLetKind,
#[visit(skip)]
pub as_alias: Option<SymbolPrimitive>,
#[visit(skip)]
pub at_alias: Option<SymbolPrimitive>,
#[visit(skip)]
pub by_alias: Option<SymbolPrimitive>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum FromLetKind {
Scan,
Unpivot,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Join {
#[visit(skip)]
pub kind: JoinKind,
pub left: Box<FromSource>,
pub right: Box<FromSource>,
pub predicate: Option<AstNode<JoinSpec>>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum JoinKind {
Inner,
Left,
Right,
Full,
Cross,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum JoinSpec {
On(Box<Expr>),
Using(Vec<Path>),
#[visit(skip)]
Natural,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct GroupByExpr {
#[visit(skip)]
pub strategy: GroupingStrategy,
pub keys: Vec<AstNode<GroupKey>>,
#[visit(skip)]
pub group_as_alias: Option<SymbolPrimitive>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum GroupingStrategy {
GroupFull,
GroupPartial,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct GroupKey {
pub expr: Box<Expr>,
#[visit(skip)]
pub as_alias: Option<SymbolPrimitive>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct OrderByExpr {
pub sort_specs: Vec<AstNode<SortSpec>>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct LimitOffsetClause {
pub limit: Option<Box<Expr>>,
pub offset: Option<Box<Expr>>,
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct SortSpec {
pub expr: Box<Expr>,
#[visit(skip)]
pub ordering_spec: Option<OrderingSpec>,
#[visit(skip)]
pub null_ordering_spec: Option<NullOrderingSpec>,
}
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum OrderingSpec {
Asc,
Desc,
}
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum NullOrderingSpec {
First,
Last,
}
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum Type {
NullType,
BooleanType,
Integer2Type,
Integer4Type,
Integer8Type,
DecimalType,
NumericType,
RealType,
DoublePrecisionType,
TimestampType,
CharacterType,
CharacterVaryingType,
MissingType,
StringType,
SymbolType,
BlobType,
ClobType,
DateType,
TimeType,
ZonedTimestampType,
StructType,
TupleType,
ListType,
SexpType,
BagType,
AnyType,
CustomType(CustomType),
}
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum CustomTypeParam {
Lit(Lit),
Type(Type),
}
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum CustomTypePart {
Name(SymbolPrimitive),
Parameterized(SymbolPrimitive, Vec<CustomTypeParam>),
}
#[derive(Visit, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct CustomType {
#[visit(skip)]
pub parts: Vec<CustomTypePart>,
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct SymbolPrimitive {
pub value: String,
pub case: CaseSensitivity,
}
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum CaseSensitivity {
CaseSensitive,
CaseInsensitive,
}