surrealdb_core/sql/
output.rs

1use crate::sql::field::Fields;
2use revision::revisioned;
3use serde::{Deserialize, Serialize};
4use std::fmt::{self, Display};
5
6#[revisioned(revision = 1)]
7#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Hash)]
8#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
9#[non_exhaustive]
10pub enum Output {
11	None,
12	Null,
13	Diff,
14	After,
15	Before,
16	Fields(Fields),
17}
18
19impl Default for Output {
20	fn default() -> Self {
21		Self::None
22	}
23}
24
25impl Display for Output {
26	fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
27		f.write_str("RETURN ")?;
28		match self {
29			Self::None => f.write_str("NONE"),
30			Self::Null => f.write_str("NULL"),
31			Self::Diff => f.write_str("DIFF"),
32			Self::After => f.write_str("AFTER"),
33			Self::Before => f.write_str("BEFORE"),
34			Self::Fields(v) => Display::fmt(v, f),
35		}
36	}
37}