Skip to main content

Module params

Module params 

Source
Expand description

Driver-side parameter values for query_with(sql, &[Value]).

Tracer-bullet implementation of issue #364 (Rust leg of PRD #351). Mirrors the same Value taxonomy the Go (drivers/go/redwire/value.go) and JS (drivers/js/src/redwire.js) drivers ship: 10 variants that map 1:1 to the engine’s binder slots through reddb_server::storage::schema::Value.

Deep module pattern: this module owns only parameter serialization. Transports import it; they don’t reimplement type mapping. Two conversions are exposed:

  • Value::into_json_paramserde_json::Value for HTTP (POST /query) and any future JSON-RPC transport. Uses the {"$bytes": ...} / {"$ts": ...} / {"$uuid": ...} envelope agreed in ADR 0001 / PRD #351.
  • Value::into_schema_value (cfg embedded) → SchemaValue for the in-process binder. Avoids JSON round-trip on the hot embedded path.

IntoValue covers the natural Rust → Value conversions called out by the issue: primitives, Vec<f32>, &[u8], serde_json::Value, chrono::DateTime (when chrono is in the caller’s deps — we accept a plain i64 seconds-since-epoch so we don’t force a chrono dep on the client crate), and Uuid (16-byte raw form — callers using the uuid crate convert via Uuid::as_bytes).

Enums§

Value
One parameter value for a query_with(sql, params) call.

Traits§

IntoParams
Convert user-facing parameter containers into the driver Value list.
IntoValue
Ergonomic conversions so callers can write db.query_with(sql, &[42i64.into(), "alice".into()]).