Skip to main content

surrealdb_expr/expr/convert/statements/
insert.rs

1//! `sql` -> `expr` conversions for [`crate::sql::statements::insert`].
2//!
3//! Lives in core rather than beside the AST: `surrealdb-sql` sits below
4//! core, so it cannot name `expr` types.
5
6use crate::sql::statements::insert::*;
7
8impl From<InsertStatement> for crate::expr::statements::InsertStatement {
9	fn from(v: InsertStatement) -> Self {
10		crate::expr::statements::InsertStatement {
11			into: v.into.map(Into::into),
12			data: v.data.into(),
13			ignore: v.ignore,
14			update: v.update.map(Into::into),
15			output: v.output.map(Into::into),
16			timeout: v.timeout.into(),
17			relation: v.relation,
18		}
19	}
20}
21
22impl From<crate::expr::statements::InsertStatement> for InsertStatement {
23	fn from(v: crate::expr::statements::InsertStatement) -> Self {
24		InsertStatement {
25			into: v.into.map(Into::into),
26			data: v.data.into(),
27			ignore: v.ignore,
28			update: v.update.map(Into::into),
29			output: v.output.map(Into::into),
30			timeout: v.timeout.into(),
31			relation: v.relation,
32		}
33	}
34}