pub enum Reddb {
Embedded(EmbeddedClient),
Unavailable(&'static str),
}Expand description
Top-level client handle. Use Reddb::connect to get one.
Variants§
Embedded(EmbeddedClient)
Constructed when a feature gate would have produced a real
variant but the feature is disabled. Every method on this
variant returns a FEATURE_DISABLED error so build-time
configuration bugs surface as runtime errors with a clear
remediation, not as missing trait impls.
Implementations§
Source§impl Reddb
impl Reddb
Sourcepub async fn connect(uri: &str) -> Result<Self>
pub async fn connect(uri: &str) -> Result<Self>
Open a connection. The backend is selected from the URI scheme.
pub async fn query(&self, sql: &str) -> Result<QueryResult>
Sourcepub async fn query_with<P: IntoParams>(
&self,
sql: &str,
params: P,
) -> Result<QueryResult>
pub async fn query_with<P: IntoParams>( &self, sql: &str, params: P, ) -> Result<QueryResult>
Parameterized query — $N placeholders in sql are bound to
params[N-1]. Empty params is equivalent to Self::query.
Native type mapping (driver-side, IntoValue):
| Rust | Engine Value variant |
|---|---|
i8..i64 / u8..u32 | Integer (i64) |
bool | Boolean |
f32 / f64 | Float (f64) |
&str / String | Text |
Vec<u8> / &[u8] | Blob |
Vec<f32> / &[f32] | Vector |
Option<T> | Null when None |
serde_json::Value | Json |
Value::Timestamp | Timestamp (seconds) |
Value::Uuid | Uuid (16 raw bytes) |
Today the Reddb::Embedded, [Reddb::Grpc], and [Reddb::Http]
transports carry parameters end-to-end.
Sourcepub async fn execute_with<P: IntoParams>(
&self,
sql: &str,
params: P,
) -> Result<QueryResult>
pub async fn execute_with<P: IntoParams>( &self, sql: &str, params: P, ) -> Result<QueryResult>
Parameterized execution for DML statements. This is an alias for
Self::query_with because RedDB returns one query result envelope for
SELECT and DML.
pub async fn insert( &self, collection: &str, payload: &JsonValue, ) -> Result<InsertResult>
pub async fn bulk_insert( &self, collection: &str, payloads: &[JsonValue], ) -> Result<BulkInsertResult>
pub async fn delete(&self, collection: &str, id: &str) -> Result<u64>
pub async fn close(&self) -> Result<()>
pub fn kv(&self) -> KvClient<'_>
pub fn config(&self) -> ConfigClient<'_>
pub fn vault(&self) -> VaultClient<'_>
pub fn config_collection<'a>(&'a self, collection: &'a str) -> ConfigClient<'a>
pub fn vault_collection<'a>(&'a self, collection: &'a str) -> VaultClient<'a>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Reddb
impl !RefUnwindSafe for Reddb
impl Send for Reddb
impl Sync for Reddb
impl Unpin for Reddb
impl UnsafeUnpin for Reddb
impl !UnwindSafe for Reddb
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