1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// Copyright (C) 2026 Gabriel Shea
// Licensed under either of the Apache License, Version 2.0 or the MIT
// license, at your option.
//! # razeri-plugin-contract
//!
//! **The contract a Razeri dialect plugin is written against.**
//!
//! This crate and `razeri-plugin-api` are the two open crates in Razeri's
//! workspace. Everything a plugin author needs in order to *describe* and
//! *render* a database platform lives here; nothing else does. It depends on
//! `serde` and on nothing else at all, which is what lets a plugin be built,
//! published and consumed outside this repository.
//!
//! ## What is in here
//!
//! **The rendering hierarchy** — ten traits, layered so that a new dialect
//! implements four required methods and inherits ANSI-standard behaviour for
//! the rest:
//!
//! 1. [`SqlRenderer`] — core SQL rendering (the four required methods)
//! 2. [`ExpressionRenderer`] — expressions, with ANSI defaults
//! 3. [`DdlRenderer`] — DDL, with ANSI defaults
//! 4. [`DmlRenderer`] — DML, with ANSI defaults
//! 5. [`ProcedureRenderer`] — stored procedures and functions
//! 6. [`FormulaRenderer`] — formulas, with ANSI defaults
//! 7. [`TaskRenderer`] — scheduled tasks
//! 8. [`ReplicationRenderer`] — data extraction, loading and key-function deployment
//! 9. [`StorageRenderer`] — partitioning, compression and index strategy
//! 10. [`DialectCapabilities`] — what the platform's SQL can and cannot do
//!
//! **The vocabulary those traits speak**: [`DataType`] and [`DataTypeRef`], the
//! [`storage_strategy::StoragePlan`] a [`StorageRenderer`] translates, the
//! [`StoragePlatform`] a storage plugin names, and [`DialectFamily`], the
//! platform's own identity.
//!
//! **The spelling a source gives a day** — [`date_format`]. One import
//! arrives with `1/1/2015` in one column and `2015-01-01T00:00:00Z` in the
//! next; the design states the spelling, this crate reads it once into a list
//! of directives, and each engine translates that list into its own pattern
//! language through [`ExpressionRenderer::render_parse_datetime`]. A directive
//! an engine cannot spell is refused by name.
//!
//! **The fan-out an engine states** — [`flatten`]. One row holding an array
//! becomes one row per element, and every engine spells that differently, so
//! the dialect answers with the whole shape rather than filling in a template.
//!
//! **The decisions a dialect states rather than a core crate deciding for it**,
//! starting with [`SidSpelling`] — how this engine spells a surrogate key —
//! and continuing with [`ProcedureForm`] and [`ScalarFunctionForm`], the
//! routine grammars it speaks, [`MergeShape`], how it upserts, and
//! [`EvolutionAnswers`], what it keeps when a table that already holds rows
//! changes shape.
//!
//! **The surrogate key's composition** — [`sid`] turns a [`SidSpelling`] into
//! the key expression an engine runs. It is here rather than in the product
//! because a dialect author who cannot render their own key expression cannot
//! run it either, and *"the same key on every engine"* is then a claim nobody
//! outside this repository can check.
//!
//! **The named routine grammars, spelled** — [`routine_render`]. A dialect
//! whose engine has stored procedures in a grammar of its own renders the whole
//! `CREATE` itself, and *"PL/pgSQL with one tweak"* used to mean writing the
//! whole thing from nothing. These three functions write out the grammar a
//! dialect is nearly the same as, so it can start there and say what differs.
//!
//! ## What is deliberately not in here
//!
//! Razeri's design model, and the renderers that turn it into Razeri's own
//! output. A plugin says what its engine spells; Razeri composes. That division
//! is why one contract crate can be open while the product is not.
//!
//! The routine grammars are the one thing on both sides of that line, and they
//! are here because they belong to the engines rather than to Razeri's design: a
//! plugin author who cannot read the grammar next to theirs has to guess at it.
//!
//! ## How this crate is versioned
//!
//! While the major version is zero:
//!
//! - **a change to a trait's method set bumps the minor version** — a method
//! added, removed or renamed, whether or not it carries a default body;
//! - **documentation and fixes bump the patch version.**
//!
//! The rule is about who decides when a plugin's behaviour changes. Cargo
//! flows a patch release to every plugin pinned at the minor the next time it
//! builds, and flows a minor release to nobody. A defaulted method costs an
//! existing plugin no line of code, and it still changes what that plugin
//! *says*: an engine that has not implemented the new method now answers the
//! default, and its users meet whatever Razeri does with that answer — a
//! refusal they had never seen, arriving because somebody else released. So a
//! new method is opted into, and the plugin author chooses the day.
//!
//! This is stricter than semantic versioning requires of a zero-major crate,
//! deliberately: the looser reading saves a version number and spends a
//! plugin author's afternoon.
//!
//! ### What 0.5.0 adds to the method set
//!
//! - [`StorageRenderer::render_partition_retain_procedure`] takes the
//! companion table a load sets rows aside in, so one call to a retention
//! procedure reaches both tables.
//! - [`ExpressionRenderer::render_parse_datetime`] renders the parse of a
//! value the source spells its own way into a date or a timestamp.
pub use *;
pub use *;
pub use *;
pub use ;
pub use ;
pub use DialectFamily;
pub use *;
pub use ;
pub use *;
pub use *;
pub use ProcedureLogLevel;
pub use *;
pub use *;
pub use *;
pub use ;
pub use *;
pub use sid_expression;
pub use *;
pub use StoragePlatform;
pub use *;
pub use *;