surrealdb_core/sql/
cond.rs

1use crate::sql::statements::info::InfoStructure;
2use crate::sql::value::Value;
3use revision::revisioned;
4use serde::{Deserialize, Serialize};
5use std::fmt;
6use std::ops::Deref;
7
8#[revisioned(revision = 1)]
9#[derive(Clone, Debug, Default, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Hash)]
10#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
11#[non_exhaustive]
12pub struct Cond(pub Value);
13
14impl Deref for Cond {
15	type Target = Value;
16	fn deref(&self) -> &Self::Target {
17		&self.0
18	}
19}
20
21impl fmt::Display for Cond {
22	fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
23		write!(f, "WHERE {}", self.0)
24	}
25}
26
27impl InfoStructure for Cond {
28	fn structure(self) -> Value {
29		self.0.structure()
30	}
31}