Skip to main content

Crate surrealdb_sql

Crate surrealdb_sql 

Source
Expand description

The abstract syntax tree for SurrealQL.

This is the shape a query has immediately after parsing, before any lowering, name resolution, or planning. Ast is the whole of a parsed query; Expr is a single expression within one.

§Layer

The AST is the bottom of the language stack. surrealdb-syn builds it and surrealdb-core lowers it into the expression layer, so everything this crate names sits below it: surrealdb-strand, surrealdb-common, surrealdb-types, surrealdb-iam, and the upstream scalar crates (chrono, uuid, rust_decimal, regex, bytes, geo-types). Nothing here reaches up into the parser, the expression layer, the catalog, or the engine.

Lowering therefore lives with the consumer: core owns the sql -> expr conversions in its expr::convert module. The conversions this crate does own are the ones the orphan rule pins here, between an AST node and its surrealdb-types counterpart.

§Scope

The AST is parse-only. No node is persisted, so nothing here carries a storage-format guarantee and this crate does not depend on revision. Where a vocabulary type also has to be stored, the persisted form is a separate revisioned twin at the catalog layer and the two are bridged by From in both directions, so a change to how something parses or renders cannot move the bytes on disk.

§Stability

This crate is an internal implementation detail of SurrealDB with no stability guarantee. It is scheduled for deletion once the greenfield parser reaches parity and takes over the same layer, so its API surface should not grow. Depend on surrealdb or surrealdb-core instead.

Unstable!

This crate is SurrealDB internal API. It does not adhere to SemVer and its API is free to change and break code even between patch versions. If you are looking for a stable interface to the SurrealDB library please have a look at the Rust SDK.

Re-exports§

pub use self::access_type::AccessType;
pub use self::algorithm::Algorithm;
pub use self::api_method::ApiMethod;
pub use self::ast::Ast;
pub use self::ast::ExplainFormat;
pub use self::ast::TopLevelExpr;
pub use self::base::Base;
pub use self::block::Block;
pub use self::changefeed::ChangeFeed;
pub use self::closure::Closure;
pub use self::cond::Cond;
pub use self::constant::Constant;
pub use self::cover::CoverStmts;
pub use self::data::Data;
pub use self::dir::Dir;
pub use self::event_kind::EventKind;
pub use self::explain::Explain;
pub use self::expression::Expr;
pub use self::fetch::Fetch;
pub use self::fetch::Fetchs;
pub use self::field::Field;
pub use self::field::Fields;
pub use self::function::Function;
pub use self::function::FunctionCall;
pub use self::group::Group;
pub use self::group::Groups;
pub use self::ident::Ident;
pub use self::idiom::Idiom;
pub use self::index::Index;
pub use self::kind::Kind;
pub use self::limit::Limit;
pub use self::literal::Literal;
pub use self::lookup::Lookup;
pub use self::mock::Mock;
pub use self::model::Model;
pub use self::module::ModuleExecutable;
pub use self::module::ModuleName;
pub use self::module::SiloExecutable;
pub use self::module::SurrealismExecutable;
pub use self::operator::AssignOperator;
pub use self::operator::BinaryOperator;
pub use self::operator::PostfixOperator;
pub use self::operator::PrefixOperator;
pub use self::order::Order;
pub use self::output::Output;
pub use self::param::Param;
pub use self::part::Part;
pub use self::permission::FieldPermissions;
pub use self::permission::Permission;
pub use self::permission::Permissions;
pub use self::record_id::RecordIdKeyGen;
pub use self::record_id::RecordIdKeyLit;
pub use self::record_id::RecordIdKeyRangeLit;
pub use self::record_id::RecordIdLit;
pub use self::scoring::Scoring;
pub use self::script::Script;
pub use self::split::Split;
pub use self::split::Splits;
pub use self::start::Start;
pub use self::statements::CreateStatement;
pub use self::statements::DefineFunctionStatement;
pub use self::statements::DefineIndexStatement;
pub use self::statements::DefineModelStatement;
pub use self::statements::DefineModuleStatement;
pub use self::statements::DeleteStatement;
pub use self::statements::InsertStatement;
pub use self::statements::KillStatement;
pub use self::statements::LiveStatement;
pub use self::statements::RelateStatement;
pub use self::statements::SelectStatement;
pub use self::statements::UpdateStatement;
pub use self::statements::UpsertStatement;
pub use self::table_name::TableName;
pub use self::table_type::TableType;
pub use self::view::View;
pub use self::with::With;

Modules§

access
access_type
algorithm
analyzer_function
Helpers for analyzer FUNCTION clause references (fn:: and mod::).
api_method
ast
base
block
builtin_paths
The builtin path table: every a::b::c name the language recognises.
changefeed
closure
cond
constant
cover
data
dir
event_kind
explain
expression
fetch
field
file
filter
function
group
ident
idiom
index
kind
language
limit
literal
lookup
method
The static mirror of the builtin method dispatch tables.
mock
model
module
operator
order
output
param
part
permission
read_only
Whether a statement can run inside a read-only transaction.
record_id
reference
scoring
script
split
start
statements
table_name
table_type
tokenizer
user
view
with