Skip to main content

surql_parser/upstream/sql/
dir.rs

1use revision::revisioned;
2use serde::{Deserialize, Serialize};
3use surrealdb_types::{SqlFormat, ToSql};
4#[revisioned(revision = 1)]
5#[derive(Clone, Debug, Default, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Hash)]
6#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
7pub enum Dir {
8	/// `<-`
9	In,
10	/// `->`
11	Out,
12	/// `<->`
13	#[default]
14	Both,
15}
16impl ToSql for Dir {
17	fn fmt_sql(&self, f: &mut String, _fmt: SqlFormat) {
18		f.push_str(match self {
19			Self::In => "<-",
20			Self::Out => "->",
21			Self::Both => "<->",
22		})
23	}
24}