pub struct EmbeddedClient { /* private fields */ }Expand description
In-process handle to a RedDB engine.
Implementations§
Source§impl EmbeddedClient
impl EmbeddedClient
Sourcepub fn in_memory() -> Result<Self>
pub fn in_memory() -> Result<Self>
Open an ephemeral, tempfile-backed database. Equivalent to
connect("memory://").
pub fn query(&self, sql: &str) -> Result<QueryResult>
Sourcepub fn insert(
&self,
collection: &str,
payload: &JsonValue,
) -> Result<InsertResult>
pub fn insert( &self, collection: &str, payload: &JsonValue, ) -> Result<InsertResult>
Single-row insert. Routes through the same
runtime.create_rows_batch_columnar port that
Self::bulk_insert uses (#110), passing a one-row batch.
Skips build_insert_sql + execute_query, so this hot
autocommit path pays zero SQL build / lex / parse / plan cost
when the collection carries no contract.
Sourcepub fn bulk_insert(
&self,
collection: &str,
payloads: &[JsonValue],
) -> Result<u64>
pub fn bulk_insert( &self, collection: &str, payloads: &[JsonValue], ) -> Result<u64>
Routes through runtime.create_rows_batch_columnar, which fast-paths
to the prevalidated columnar kernel when the collection carries no
contract — same shape MSG_BULK_INSERT_BINARY already uses on the
wire path. Result: one WAL append per batch instead of one per row,
no per-row SQL build / lex / parse / plan, and no per-row (String, Value) tuple materialisation when the collection is contract-free.
Heterogeneous payloads (rows with differing key sets) fall back to
the per-row execute_query path so existing semantics are preserved
for callers that mix shapes.
pub fn delete(&self, collection: &str, id: &str) -> Result<u64>
pub fn close(&self) -> Result<()>
pub fn version() -> &'static str
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EmbeddedClient
impl !RefUnwindSafe for EmbeddedClient
impl Send for EmbeddedClient
impl Sync for EmbeddedClient
impl Unpin for EmbeddedClient
impl UnsafeUnpin for EmbeddedClient
impl !UnwindSafe for EmbeddedClient
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
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>
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>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request