reddb-client
Official Rust client for RedDB.
One connection-string API across embedded, gRPC, HTTP, and
RedWire transports. Also hosts the red_client binary and the
workspace-internal connector used by red's REPL and
reddb-server's rpc_stdio mode.
Quickstart (library)
[]
= "0.2"
use ;
# async
Parameterized queries
query_with(sql, &[params]) binds positional $N placeholders. SQL
literals never carry untrusted values — vector / int / text params
travel through the same engine binder the prepared-statement path uses,
so injection-by-string is structurally impossible.
use ;
# async
The native RedWire client uses the same parameter API when the crate is built
with --features redwire:
use ;
use Value;
# async
Native Rust → engine Value mapping:
| Rust | Engine variant |
|---|---|
bool |
Boolean |
i8..i64 / u8..u32 |
Integer (i64) |
f32 / f64 |
Float (f64) |
&str / String |
Text |
Vec<u8> / &[u8] |
Blob |
Vec<f32> / &[f32] |
Vector |
Option<T> (None) |
Null |
serde_json::Value |
Json |
Value::Int64(n) |
Int (i64 compatibility constructor) |
Value::Timestamp(s) |
Timestamp (seconds) |
Value::Uuid(b) |
Uuid (16 raw bytes) |
Today the embedded, http, and Rust grpc transports carry parameters
end-to-end. The native Rust RedWire client also carries parameters end-to-end
with QueryWithParams and depends on the server advertising FEATURE_PARAMS.
Cargo features
embedded(default) — pulls the engine in-process formemory:///file:///URIs.grpc— async tonic client forgrpc:///red://.http— REST client over reqwest+rustls forhttp:///https://.redwire— native RedWire TCP client (no engine).redwire-tls— adds TLS / mTLS to the RedWire transport.
Disable defaults to drop the engine: default-features = false.
red_client binary
The crate also hosts the red_client binary (built with
cargo build -p reddb-io-client --bin red_client --no-default-features).
It is the thin remote-only client used by ops tooling — no
engine, no embedded backend, just transports:
| Scheme | Status |
|---|---|
red://host[:port] |
gRPC, default port 5050 |
reds://host[:port] |
TODO (TLS not yet wired in the bin) |
grpc://host[:port] |
gRPC, default port 5055 |
http://host[:port] |
REST |
memory: / file:// |
rejected (exit 2, points to red) |
red_client is guarded by SIZE_BUDGET (stripped
release bytes); CI runs ./scripts/check-red-client-size.sh on
every PR to catch accidental engine re-linkage.
Module layout
crate::Reddb/JsonValue/ClientError— published high-level API.crate::connect::{Target, parse}— back-compat shim overreddb-wire's connection-string parser.crate::connector::{RedDBClient, repl, http, redwire}— workspace-internal connector consumed by theredREPL,red_clientbin, andreddb-server's rpc_stdio mode. The gRPC connector type itself lives in thereddb-client-connectorsibling crate to break a path-dependency cycle.