Skip to main content

surrealdb_expr/expr/statements/
insert.rs

1use surrealdb_types::{SqlFormat, ToSql};
2
3use crate::expr::{Data, Expr, Output};
4
5#[derive(Clone, Debug, Eq, PartialEq, Hash)]
6pub struct InsertStatement {
7	pub into: Option<Expr>,
8	pub data: Data,
9	/// Does the statement have the ignore clause.
10	pub ignore: bool,
11	pub update: Option<Data>,
12	pub output: Option<Output>,
13	pub timeout: Expr,
14	pub relation: bool,
15}
16
17impl ToSql for InsertStatement {
18	fn fmt_sql(&self, f: &mut String, fmt: SqlFormat) {
19		let stmt: crate::sql::statements::insert::InsertStatement = self.clone().into();
20		stmt.fmt_sql(f, fmt);
21	}
22}