Skip to main content

Batch

Struct Batch 

Source
pub struct Batch { /* private fields */ }
Expand description

A bounded synchronous batch; preparation is internal to Database::commit.

Implementations§

Source§

impl Batch

Source

pub fn new() -> Self

Begin an empty batch without persistent effects.

Source

pub fn at(time: Timestamp) -> Self

Begin a batch with one host-captured operation time for all managed fields. The database reads no clock; this value remains fixed for the whole batch.

Source

pub fn insert<E: Entity>(&mut self, row: &E) -> Result<(), Error>

Insert a typed record. Primary-key/uniqueness admission happens at commit.

§Errors

Refuses managed-field entities (use insert_input), encoding or batch capacity.

Source

pub fn insert_input<I: InsertInput>( &mut self, input: I, ) -> Result<I::Entity, Error>

Resolve a typed insert input, append it to this batch and return its full row. This is preparation, not a commit; the returned row is not yet persistent. Explicit None remains absence, while omitted fields select their declared literal default or optional absence. No defaults run during replacement.

§Errors

Refuses missing required values, field/row bounds or batch capacity. A refused input appends no mutation to the batch.

Source

pub fn replace<E: Entity>(&mut self, row: &E) -> Result<(), Error>

Replace an existing typed record, retaining its primary key. Managed fields must echo the current stored values; commit sets update time only on a real change. Read the row after commit to obtain that assigned time.

§Errors

Refuses missing operation time, encoding or batch capacity before mutation.

Source

pub fn delete<E: Entity>(&mut self, key: E::Key) -> Result<(), Error>

Delete an existing primary key; no recursive cascades are implied.

§Errors

Refuses batch capacity before persistent mutation.

Trait Implementations§

Source§

impl Default for Batch

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Forget for Batch

§

impl Freeze for Batch

§

impl Move for Batch

§

impl RefUnwindSafe for Batch

§

impl Send for Batch

§

impl Sync for Batch

§

impl Unpin for Batch

§

impl UnsafeUnpin for Batch

§

impl UnwindSafe for Batch

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.