razeri_plugin_contract/lib.rs
1// Copyright (C) 2026 Gabriel Shea
2// Licensed under either of the Apache License, Version 2.0 or the MIT
3// license, at your option.
4
5#![warn(missing_docs)]
6
7//! # razeri-plugin-contract
8//!
9//! **The contract a Razeri dialect plugin is written against.**
10//!
11//! This crate and `razeri-plugin-api` are the two open crates in Razeri's
12//! workspace. Everything a plugin author needs in order to *describe* and
13//! *render* a database platform lives here; nothing else does. It depends on
14//! `serde` and on nothing else at all, which is what lets a plugin be built,
15//! published and consumed outside this repository.
16//!
17//! ## What is in here
18//!
19//! **The rendering hierarchy** — ten traits, layered so that a new dialect
20//! implements four required methods and inherits ANSI-standard behaviour for
21//! the rest:
22//!
23//! 1. [`SqlRenderer`] — core SQL rendering (the four required methods)
24//! 2. [`ExpressionRenderer`] — expressions, with ANSI defaults
25//! 3. [`DdlRenderer`] — DDL, with ANSI defaults
26//! 4. [`DmlRenderer`] — DML, with ANSI defaults
27//! 5. [`ProcedureRenderer`] — stored procedures and functions
28//! 6. [`FormulaRenderer`] — formulas, with ANSI defaults
29//! 7. [`TaskRenderer`] — scheduled tasks
30//! 8. [`ReplicationRenderer`] — data extraction, loading and key-function deployment
31//! 9. [`StorageRenderer`] — partitioning, compression and index strategy
32//! 10. [`DialectCapabilities`] — what the platform's SQL can and cannot do
33//!
34//! **The vocabulary those traits speak**: [`DataType`] and [`DataTypeRef`], the
35//! [`storage_strategy::StoragePlan`] a [`StorageRenderer`] translates, the
36//! [`StoragePlatform`] a storage plugin names, and [`DialectFamily`], the
37//! platform's own identity.
38//!
39//! **The decisions a dialect states rather than a core crate deciding for it**,
40//! starting with [`SidSpelling`] — how this engine spells a surrogate key —
41//! and continuing with [`ProcedureForm`] and [`ScalarFunctionForm`], the
42//! routine grammars it speaks, and [`MergeShape`], how it upserts.
43//!
44//! ## What is deliberately not in here
45//!
46//! Razeri's design model, its surrogate-key *derivation*, and every renderer
47//! that produces Razeri's own output. A plugin says what its engine spells;
48//! Razeri composes. That division is why one contract crate can be open while
49//! the product is not.
50
51pub mod agnostic;
52pub mod capabilities;
53pub mod constraint_enforcement;
54pub mod data_type;
55pub mod dialect_family;
56pub mod formula_renderer;
57pub mod merge_shape;
58pub mod renderer;
59pub mod replication;
60pub mod routine_form;
61pub mod sid_spelling;
62pub mod storage_platform;
63pub mod storage_renderer;
64pub mod storage_strategy;
65pub mod task_renderer;
66
67pub use agnostic::*;
68pub use capabilities::*;
69pub use constraint_enforcement::*;
70pub use data_type::{DataType, DataTypeRef};
71pub use dialect_family::DialectFamily;
72pub use formula_renderer::*;
73pub use merge_shape::*;
74pub use renderer::*;
75pub use replication::*;
76pub use routine_form::*;
77pub use sid_spelling::*;
78pub use storage_platform::StoragePlatform;
79pub use storage_renderer::*;
80pub use task_renderer::*;