Skip to main content

TriggerBuilder

Struct TriggerBuilder 

Source
pub struct TriggerBuilder { /* private fields */ }
Expand description

Builder for constructing database triggers

Implementations§

Source§

impl TriggerBuilder

Source

pub fn new() -> Self

Create a new trigger builder

Source

pub fn name(self, name: impl Into<String>) -> Self

Set the trigger name

Source

pub fn set_name(&mut self, name: impl Into<String>)

Set the trigger name (mutable reference version for conditional building)

Source

pub fn in_schema(self, schema: impl Into<String>) -> Self

Set the schema name

Source

pub fn set_schema(&mut self, schema: impl Into<String>)

Set the schema name (mutable reference version for conditional building)

Source

pub fn on_table(self, table_name: impl Into<String>) -> Self

Set the table name

Source

pub fn set_table_name(&mut self, table_name: impl Into<String>)

Set the table name (mutable reference version for conditional building)

Source

pub fn on_table_in_schema(self, table_schema: impl Into<String>) -> Self

Set the table schema

Source

pub fn set_table_schema(&mut self, table_schema: impl Into<String>)

Set the table schema (mutable reference version for conditional building)

Source

pub fn timing(self, timing: TriggerTiming) -> Self

Set the trigger timing

Source

pub fn set_timing(&mut self, timing: TriggerTiming)

Set the trigger timing (mutable reference version for conditional building)

Source

pub fn event(self, event: TriggerEvent) -> Self

Add a trigger event

Source

pub fn add_event(&mut self, event: TriggerEvent)

Add a trigger event (mutable reference version for conditional building)

Source

pub fn events(self, events: impl IntoIterator<Item = TriggerEvent>) -> Self

Add multiple trigger events

Source

pub fn add_events(&mut self, events: impl IntoIterator<Item = TriggerEvent>)

Add multiple trigger events (mutable reference version for conditional building)

Source

pub fn orientation(self, orientation: TriggerOrientation) -> Self

Set the trigger orientation

Source

pub fn set_orientation(&mut self, orientation: TriggerOrientation)

Set the trigger orientation (mutable reference version for conditional building)

Source

pub fn function(self, function_name: impl Into<String>) -> Self

Set the function name

Source

pub fn set_function(&mut self, function_name: impl Into<String>)

Set the function name (mutable reference version for conditional building)

Source

pub fn function_in_schema(self, function_schema: impl Into<String>) -> Self

Set the function schema

Source

pub fn set_function_schema(&mut self, function_schema: impl Into<String>)

Set the function schema (mutable reference version for conditional building)

Source

pub fn condition(self, condition: impl Into<String>) -> Self

Set the trigger condition

Source

pub fn set_condition(&mut self, condition: impl Into<String>)

Set the trigger condition (mutable reference version for conditional building)

Source

pub fn update_columns( self, columns: impl IntoIterator<Item = impl Into<String>>, ) -> Self

Set specific columns for UPDATE triggers

Source

pub fn set_update_columns( &mut self, columns: impl IntoIterator<Item = impl Into<String>>, )

Set specific columns for UPDATE triggers (mutable reference version for conditional building)

Source

pub fn referencing( self, old_table: Option<String>, new_table: Option<String>, ) -> Self

Set transition table references

Source

pub fn set_referencing( &mut self, old_table: Option<String>, new_table: Option<String>, )

Set transition table references (mutable reference version for conditional building)

Source

pub fn comment(self, comment: impl Into<String>) -> Self

Set a comment on the trigger

Source

pub fn set_comment(&mut self, comment: impl Into<String>)

Set a comment on the trigger (mutable reference version for conditional building)

Source

pub fn simple() -> Self

Create a simple trigger

Source

pub fn before() -> Self

Create a BEFORE trigger

Source

pub fn after() -> Self

Create an AFTER trigger

Source

pub fn instead_of() -> Self

Create an INSTEAD OF trigger

Source

pub fn row() -> Self

Create a row-level trigger

Source

pub fn statement() -> Self

Create a statement-level trigger

Source

pub fn on_insert() -> Self

Create an INSERT trigger

Source

pub fn on_update() -> Self

Create an UPDATE trigger

Source

pub fn on_delete() -> Self

Create a DELETE trigger

Source

pub fn on_truncate() -> Self

Create a TRUNCATE trigger

Source

pub fn audit() -> Self

Create an audit trigger

Source

pub fn validation() -> Self

Create a validation trigger

Source

pub fn logging() -> Self

Create a logging trigger

Source

pub fn get_name(&self) -> Option<&str>

Get the trigger name

Source

pub fn get_schema(&self) -> Option<&str>

Get the schema name

Source

pub fn get_table_name(&self) -> Option<&str>

Get the table name

Source

pub fn get_table_schema(&self) -> Option<&str>

Get the table schema

Source

pub fn get_timing(&self) -> Option<&TriggerTiming>

Get the trigger timing

Source

pub fn get_events(&self) -> &[TriggerEvent]

Get the trigger events

Source

pub fn get_orientation(&self) -> Option<&TriggerOrientation>

Get the trigger orientation

Source

pub fn get_function_name(&self) -> Option<&str>

Get the function name

Source

pub fn get_function_schema(&self) -> Option<&str>

Get the function schema

Source

pub fn get_condition(&self) -> Option<&str>

Get the trigger condition

Source

pub fn get_update_columns(&self) -> Option<&[String]>

Get the update columns

Source

pub fn get_referencing(&self) -> Option<&TriggerReferencing>

Get the referencing clause

Source

pub fn get_comment(&self) -> Option<&str>

Get the comment

Source

pub fn event_count(&self) -> usize

Get the number of events

Source

pub fn has_event(&self, event: &TriggerEvent) -> bool

Check if the trigger has a specific event

Source

pub fn has_name(&self) -> bool

Check if the trigger has a name

Source

pub fn has_schema(&self) -> bool

Check if the trigger has a schema

Source

pub fn has_table_name(&self) -> bool

Check if the trigger has a table name

Source

pub fn has_table_schema(&self) -> bool

Check if the trigger has a table schema

Source

pub fn has_timing(&self) -> bool

Check if the trigger has timing

Source

pub fn has_events(&self) -> bool

Check if the trigger has events

Source

pub fn has_orientation(&self) -> bool

Check if the trigger has orientation

Source

pub fn has_function_name(&self) -> bool

Check if the trigger has a function name

Source

pub fn has_function_schema(&self) -> bool

Check if the trigger has a function schema

Source

pub fn has_condition(&self) -> bool

Check if the trigger has a condition

Source

pub fn has_update_columns(&self) -> bool

Check if the trigger has update columns

Source

pub fn has_referencing(&self) -> bool

Check if the trigger has referencing

Source

pub fn has_comment(&self) -> bool

Check if the trigger has a comment

Trait Implementations§

Source§

impl Clone for TriggerBuilder

Source§

fn clone(&self) -> TriggerBuilder

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 ConditionalBuilder for TriggerBuilder

Source§

fn when<F>(self, condition: bool, config_fn: F) -> Self
where F: FnOnce(&mut Self), Self: Sized,

Apply configuration conditionally Read more
Source§

fn when_else<F, G>(self, condition: bool, if_true: F, if_false: G) -> Self
where F: FnOnce(&mut Self), G: FnOnce(&mut Self), Self: Sized,

Apply configuration conditionally with a default fallback Read more
Source§

impl Debug for TriggerBuilder

Source§

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

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

impl InspectableBuilder for TriggerBuilder

Source§

fn debug_info(&self) -> String

Get a debug representation of the current builder state Read more
Source§

fn summary(&self) -> String

Get a summary of the current configuration Read more
Source§

impl SchemaBuilder for TriggerBuilder

Source§

type Output = Trigger

The type of schema object that this builder produces
Source§

type Error = TriggerBuildError

The type of error that can occur during building
Source§

fn build(self) -> Result<Self::Output, Self::Error>

Build the final schema object from the builder configuration Read more
Source§

impl ValidatableBuilder for TriggerBuilder

Source§

fn is_valid(&self) -> bool

Check if the current builder configuration is valid Read more
Source§

fn validation_errors(&self) -> Vec<String>

Get a list of validation errors for the current configuration Read more

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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more