Skip to main content

RoutineSpec

Struct RoutineSpec 

Source
#[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 security: RoutineSecurity, 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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§kind: RoutineKind

Which of the three kinds this is.

§schema: Option<String>

The schema the routine is created in, where the design names one.

§name: String

The routine’s name, unquoted.

§or_replace: bool

Whether 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: RoutineReturns

What the routine gives back.

§security: RoutineSecurity

Whose privileges the routine runs with.

§body: RoutineBody

The 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

Source

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.
Source

pub fn qualified_name(&self, quote: impl Fn(&str) -> String) -> String

The name a CREATE writes, schema included where there is one.

Parameters:

  • quote: how this engine quotes one identifier.

Trait Implementations§

Source§

impl Clone for RoutineSpec

Source§

fn clone(&self) -> RoutineSpec

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RoutineSpec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for RoutineSpec

Source§

impl PartialEq for RoutineSpec

Source§

fn eq(&self, other: &RoutineSpec) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RoutineSpec

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.