surrealdb_core/sql/statements/
option.rs1use crate::sql::ident::Ident;
2
3use revision::revisioned;
4use serde::{Deserialize, Serialize};
5use std::fmt;
6
7#[revisioned(revision = 1)]
8#[derive(Clone, Debug, Default, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Hash)]
9#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
10#[non_exhaustive]
11pub struct OptionStatement {
12 pub name: Ident,
13 pub what: bool,
14}
15
16impl fmt::Display for OptionStatement {
17 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
18 if self.what {
19 write!(f, "OPTION {}", self.name)
20 } else {
21 write!(f, "OPTION {} = FALSE", self.name)
22 }
23 }
24}