pub struct Insert<T: SurrealRecord> { /* private fields */ }Expand description
An INSERT INTO <table> … builder. Records are serialized inline as object
literals; rendering requires T: serde::Serialize.
Implementations§
Source§impl<T: SurrealRecord> Insert<T>
impl<T: SurrealRecord> Insert<T>
pub fn content(self, record: T) -> Self
Sourcepub fn return_field(self, field: &'static str) -> Self
pub fn return_field(self, field: &'static str) -> Self
Add a field to the RETURN <projection> list. Multiple calls accumulate
(RETURN id, name). Takes precedence over returning.
Sourcepub fn returning(self, r: Returning) -> Self
pub fn returning(self, r: Returning) -> Self
Set a RETURN NONE|BEFORE|AFTER|DIFF clause (used when no explicit
return_field projection is given).
pub fn data(&self) -> &[T]
Sourcepub fn to_surrealql(&self) -> Stringwhere
T: Serialize,
pub fn to_surrealql(&self) -> Stringwhere
T: Serialize,
Render INSERT INTO <table> <object|array> [RETURN …], serializing the
queued record(s) inline as SurrealQL object literals (JSON is a valid
subset). A single record renders as { … }, multiple as [ {…}, {…} ].
A RETURN projection (from return_field) renders
the field list; otherwise the returning variant.
Auto Trait Implementations§
impl<T> Freeze for Insert<T>
impl<T> RefUnwindSafe for Insert<T>where
T: RefUnwindSafe,
impl<T> Send for Insert<T>
impl<T> Sync for Insert<T>
impl<T> Unpin for Insert<T>where
T: Unpin,
impl<T> UnsafeUnpin for Insert<T>
impl<T> UnwindSafe for Insert<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more