vibesql_ast/ddl/
transaction.rs1#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
15pub enum DurabilityHint {
16 #[default]
18 Default,
19 Durable,
21 Lazy,
23 Volatile,
25}
26
27impl DurabilityHint {
28 pub fn as_sql_hint(&self) -> &'static str {
30 match self {
31 DurabilityHint::Default => "DEFAULT",
32 DurabilityHint::Durable => "DURABLE",
33 DurabilityHint::Lazy => "LAZY",
34 DurabilityHint::Volatile => "VOLATILE",
35 }
36 }
37}
38
39#[derive(Debug, Clone, PartialEq, Default)]
41pub struct BeginStmt {
42 pub durability: DurabilityHint,
44}
45
46#[derive(Debug, Clone, PartialEq)]
48pub struct CommitStmt;
49
50#[derive(Debug, Clone, PartialEq)]
52pub struct RollbackStmt;
53
54#[derive(Debug, Clone, PartialEq)]
56pub struct SavepointStmt {
57 pub name: String,
58}
59
60#[derive(Debug, Clone, PartialEq)]
62pub struct RollbackToSavepointStmt {
63 pub name: String,
64}
65
66#[derive(Debug, Clone, PartialEq)]
68pub struct ReleaseSavepointStmt {
69 pub name: String,
70}
71
72#[derive(Debug, Clone, PartialEq)]
74pub enum IsolationLevel {
75 Serializable,
76}
77
78#[derive(Debug, Clone, PartialEq)]
80pub enum TransactionAccessMode {
81 ReadOnly,
82 ReadWrite,
83}
84
85#[derive(Debug, Clone, PartialEq)]
87pub struct SetTransactionStmt {
88 pub local: bool, pub isolation_level: Option<IsolationLevel>,
90 pub access_mode: Option<TransactionAccessMode>,
91}