pub struct Batch { /* private fields */ }Expand description
A bounded synchronous batch; preparation is internal to Database::commit.
Implementations§
Source§impl Batch
impl Batch
Sourcepub fn insert<E: Entity>(&mut self, row: &E) -> Result<(), Error>
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.
Sourcepub fn insert_input<I: InsertInput>(
&mut self,
input: I,
) -> Result<I::Entity, Error>
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. An omitted ULID primary key is issued
from the local stream at the operation time. 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.
Sourcepub fn replace<E: Entity>(&mut self, row: &E) -> Result<(), Error>
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. Queuing a replacement does not produce a committed row.
§Errors
Refuses encoding or batch capacity before mutation.