Skip to main content

EmbeddedClient

Struct EmbeddedClient 

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

In-process handle to a RedDB engine.

Implementations§

Source§

impl EmbeddedClient

Source

pub fn open(path: PathBuf) -> Result<Self>

Open a persistent database at path.

Source

pub fn in_memory() -> Result<Self>

Open an ephemeral, tempfile-backed database. Equivalent to connect("memory://").

Source

pub fn query(&self, sql: &str) -> Result<QueryResult>

Source

pub fn query_with<P: IntoParams>( &self, sql: &str, params: P, ) -> Result<QueryResult>

Parameterized embedded query — see crate::Reddb::query_with. Empty params short-circuits to the legacy execute_query fast path so the parameter-less hot path pays zero overhead.

Source

pub fn execute_with<P: IntoParams>( &self, sql: &str, params: P, ) -> Result<QueryResult>

Parameterized execution for INSERT / UPDATE / DELETE. RedDB uses the same result envelope for DML as for SELECT, so this forwards to Self::query_with.

Source

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.

Source

pub fn bulk_insert( &self, collection: &str, payloads: &[JsonValue], ) -> Result<BulkInsertResult>

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.

Source

pub fn delete(&self, collection: &str, id: &str) -> Result<u64>

Source

pub fn close(&self) -> Result<()>

Source

pub fn version() -> &'static str

Trait Implementations§

Source§

impl Debug for EmbeddedClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more