surql_parser/upstream/sql/record_id/
mod.rs1use crate::compat::val::TableName;
2use crate::upstream::fmt::EscapeIdent;
3use surrealdb_types::{SqlFormat, ToSql, write_sql};
4pub mod key;
5pub use key::{RecordIdKeyGen, RecordIdKeyLit};
6pub mod range;
7pub use range::RecordIdKeyRangeLit;
8#[derive(Clone, Debug, Eq, PartialEq)]
10#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
11pub struct RecordIdLit {
12 pub table: String,
14 pub key: RecordIdKeyLit,
15}
16impl ToSql for RecordIdLit {
17 fn fmt_sql(&self, f: &mut String, sql_fmt: SqlFormat) {
18 write_sql!(f, sql_fmt, "{}:{}", EscapeIdent(&self.table), self.key);
19 }
20}