pub struct Trigger {
pub name: String,
pub schema: Option<String>,
pub table: String,
pub timing: TriggerTiming,
pub events: HashSet<TriggerEvent>,
pub level: TriggerLevel,
pub update_of: Option<UpdateOf>,
pub condition: Option<TriggerCondition>,
pub action: TriggerAction,
pub enabled: bool,
pub comment: Option<String>,
}Expand description
A database trigger definition.
Fields§
§name: StringTrigger name.
schema: Option<String>Schema name (optional).
table: StringTable or view the trigger is attached to.
timing: TriggerTimingWhen the trigger fires (BEFORE/AFTER/INSTEAD OF).
events: HashSet<TriggerEvent>Events that fire the trigger.
level: TriggerLevelRow-level or statement-level.
update_of: Option<UpdateOf>Optional column list for UPDATE OF.
condition: Option<TriggerCondition>Optional WHEN condition.
action: TriggerActionThe action to execute.
enabled: boolWhether the trigger is enabled.
comment: Option<String>Optional comment/description.
Implementations§
Source§impl Trigger
impl Trigger
Sourcepub fn builder(name: impl Into<String>) -> TriggerBuilder
pub fn builder(name: impl Into<String>) -> TriggerBuilder
Create a new trigger builder.
Sourcepub fn qualified_name(&self) -> Cow<'_, str>
pub fn qualified_name(&self) -> Cow<'_, str>
Get the fully qualified trigger name.
Sourcepub fn qualified_table(&self) -> Cow<'_, str>
pub fn qualified_table(&self) -> Cow<'_, str>
Get the fully qualified table name.
Sourcepub fn to_postgres_sql(&self) -> QueryResult<String>
pub fn to_postgres_sql(&self) -> QueryResult<String>
Generate PostgreSQL CREATE TRIGGER SQL.
Sourcepub fn to_mysql_sql(&self) -> QueryResult<String>
pub fn to_mysql_sql(&self) -> QueryResult<String>
Generate MySQL CREATE TRIGGER SQL.
Sourcepub fn to_sqlite_sql(&self) -> QueryResult<String>
pub fn to_sqlite_sql(&self) -> QueryResult<String>
Generate SQLite CREATE TRIGGER SQL.
Sourcepub fn to_mssql_sql(&self) -> QueryResult<String>
pub fn to_mssql_sql(&self) -> QueryResult<String>
Generate MSSQL CREATE TRIGGER SQL.
Sourcepub fn to_sql(&self, db_type: DatabaseType) -> QueryResult<String>
pub fn to_sql(&self, db_type: DatabaseType) -> QueryResult<String>
Generate SQL for the configured database type.
Sourcepub fn drop_sql(&self, db_type: DatabaseType) -> String
pub fn drop_sql(&self, db_type: DatabaseType) -> String
Generate DROP TRIGGER SQL.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Trigger
impl<'de> Deserialize<'de> for Trigger
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Trigger
impl StructuralPartialEq for Trigger
Auto Trait Implementations§
impl Freeze for Trigger
impl RefUnwindSafe for Trigger
impl Send for Trigger
impl Sync for Trigger
impl Unpin for Trigger
impl UnwindSafe for Trigger
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more