grafbase_sql_ast/ast/
query.rs1use crate::ast::{Delete, Insert, Select, Update};
2
3#[derive(Debug, Clone, PartialEq)]
5pub enum Query<'a> {
6 Select(Box<Select<'a>>),
7 Insert(Box<Insert<'a>>),
8 Update(Box<Update<'a>>),
9 Delete(Box<Delete<'a>>),
10}
11
12impl<'a> Query<'a> {
13 pub fn is_select(&self) -> bool {
14 matches!(self, Query::Select(_))
15 }
16
17 pub fn is_insert(&self) -> bool {
18 matches!(self, Query::Insert(_))
19 }
20
21 pub fn is_update(&self) -> bool {
22 matches!(self, Query::Update(_))
23 }
24
25 pub fn is_delete(&self) -> bool {
26 matches!(self, Query::Delete(_))
27 }
28}