cql3_parser/
create_trigger.rs

1use crate::common::FQName;
2use std::fmt::{Display, Formatter};
3
4/// data for the `CreateTrigger` statement.
5#[derive(PartialEq, Debug, Clone)]
6pub struct CreateTrigger {
7    /// only create if it does not exist.
8    pub not_exists: bool,
9    /// the name of the trigger.
10    pub name: FQName,
11    /// the class the implements the trigger.
12    pub class: String,
13}
14
15impl Display for CreateTrigger {
16    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
17        write!(
18            f,
19            "CREATE TRIGGER {}{} USING {}",
20            if self.not_exists {
21                "IF NOT EXISTS "
22            } else {
23                ""
24            },
25            self.name,
26            self.class
27        )
28    }
29}