2024-04-16 08:05:07 +00:00
|
|
|
use crate::sql::statements::info::InfoStructure;
|
2023-11-18 13:56:13 +00:00
|
|
|
use crate::sql::value::Value;
|
2023-08-17 18:03:46 +00:00
|
|
|
use revision::revisioned;
|
2020-06-29 15:36:01 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use std::fmt;
|
2022-05-05 04:51:13 +00:00
|
|
|
use std::ops::Deref;
|
2020-06-29 15:36:01 +00:00
|
|
|
|
2023-08-17 18:03:46 +00:00
|
|
|
#[revisioned(revision = 1)]
|
2024-04-17 14:27:55 +00:00
|
|
|
#[derive(Clone, Debug, Default, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Hash)]
|
2024-01-09 15:34:52 +00:00
|
|
|
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
|
2024-04-02 20:12:08 +00:00
|
|
|
#[non_exhaustive]
|
2022-05-05 04:51:13 +00:00
|
|
|
pub struct Cond(pub Value);
|
|
|
|
|
|
|
|
impl Deref for Cond {
|
|
|
|
type Target = Value;
|
|
|
|
fn deref(&self) -> &Self::Target {
|
|
|
|
&self.0
|
|
|
|
}
|
2020-06-29 15:36:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl fmt::Display for Cond {
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
2022-05-05 04:51:13 +00:00
|
|
|
write!(f, "WHERE {}", self.0)
|
2020-06-29 15:36:01 +00:00
|
|
|
}
|
|
|
|
}
|
2024-04-16 08:05:07 +00:00
|
|
|
impl InfoStructure for Cond {
|
|
|
|
fn structure(self) -> Value {
|
|
|
|
self.0.structure()
|
|
|
|
}
|
|
|
|
}
|