#[non_exhaustive]pub struct RoutineSpec {
pub kind: RoutineKind,
pub schema: Option<String>,
pub name: String,
pub or_replace: bool,
pub parameters: Vec<RoutineParameter>,
pub declarations: Vec<RoutineDeclaration>,
pub returns: RoutineReturns,
pub body: RoutineBody,
pub comment: Option<String>,
}Expand description
A routine Razeri composed, for a dialect that spells its own grammar.
Handed to SqlRenderer::render_procedure
and its two siblings when the dialect answered Custom.
It is #[non_exhaustive]: Razeri may carry one more fact about a routine
later, and a dialect built against today’s contract must keep compiling.
Read the fields; do not construct one outside Razeri except in a test, where
RoutineSpec::new gives you an empty routine of a kind to fill in.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.kind: RoutineKindWhich of the three kinds this is.
schema: Option<String>The schema the routine is created in, where the design names one.
name: StringThe routine’s name, unquoted.
or_replace: boolWhether the design asked for a replace rather than a plain create. An
engine with no OR REPLACE says so its own way — a DROP in front, or
nothing at all.
parameters: Vec<RoutineParameter>The routine’s parameters, in order.
declarations: Vec<RoutineDeclaration>Local variables the body reads, in order. Empty for a function.
returns: RoutineReturnsWhat the routine gives back.
body: RoutineBodyThe body.
comment: Option<String>The description a reader of the DDL should find on the routine. Where the engine has no comment clause, it belongs in a comment.
Implementations§
Source§impl RoutineSpec
impl RoutineSpec
Sourcepub fn new(kind: RoutineKind, name: impl Into<String>) -> Self
pub fn new(kind: RoutineKind, name: impl Into<String>) -> Self
An empty routine of one kind, to fill in.
The constructor exists so that a dialect’s own tests can build the spec
their render method is going to receive without waiting for Razeri to
compose one, and so the struct can stay #[non_exhaustive] — a field
added later reaches those tests as a default rather than as a broken
build.
Parameters:
kind: which of the three routine kinds this is;name: the routine’s name, unquoted.
Trait Implementations§
Source§impl Clone for RoutineSpec
impl Clone for RoutineSpec
Source§fn clone(&self) -> RoutineSpec
fn clone(&self) -> RoutineSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more