Skip to main content

surrealdb_sql/
dir.rs

1use serde::{Deserialize, Serialize};
2use surrealdb_types::{SqlFormat, ToSql};
3
4#[derive(Clone, Debug, Default, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Hash)]
5#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
6pub enum Dir {
7	/// `<-`
8	In,
9	/// `->`
10	Out,
11	/// `<->`
12	#[default]
13	Both,
14}
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}