surrealdb_core/sql/
with.rs

1use revision::revisioned;
2use serde::{Deserialize, Serialize};
3use std::fmt::{Display, Formatter, Result};
4
5#[revisioned(revision = 1)]
6#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Serialize, Deserialize, Hash)]
7#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
8#[non_exhaustive]
9pub enum With {
10	NoIndex,
11	Index(Vec<String>),
12}
13
14impl Display for With {
15	fn fmt(&self, f: &mut Formatter) -> Result {
16		f.write_str("WITH")?;
17		match self {
18			With::NoIndex => f.write_str(" NOINDEX"),
19			With::Index(i) => {
20				f.write_str(" INDEX ")?;
21				f.write_str(&i.join(","))
22			}
23		}
24	}
25}