Summary
ToSqlParam is implemented for primitives, Date/Time/Timestamp/OffsetTimestamp, byte slices, and strings, but not for Numeric, Interval, Geography, or JSON. Users who want to bind these types as query parameters must stringify them by hand — even though the types themselves already round-trip through IntoValue/RowValue and SqlType::Json is a recognized SQL type.
Current state
hyperdb-api/src/params.rs lists every implementing type starting at line 27. Confirmed missing impls:
$ grep -nE "impl ToSqlParam (for|<.+> for) (Numeric|Interval|Geography|serde_json|Json)" hyperdb-api/src/params.rs
# (no output)
Existing impls per params.rs:114-416:
- Numeric:
i16, i32, i64, f32, f64, bool
- Strings/bytes:
str, String, &str, [u8], Vec<u8>
- Time:
Date, Time, Timestamp, OffsetTimestamp
- Generic:
&T, Option<T>
Original gap analysis: §5 of docs/RUST_API_GAP_ANALYSIS.md (predecessor repo) — "Interval — exists in IntoValue/RowValue but not ToSqlParam. Numeric — same. Geography — neither ToSqlParam nor IntoValue. serde_json::Value / native JSON type — SqlType::Json exists, but no first-class reader/writer."
Proposed work
Backwards compatibility
Purely additive. New trait impls + one new (default-off) feature flag for the serde_json integration.
Open questions
- For
Numeric: bind via the binary encoding path (encode_param) or text (to_sql_literal)? Binary is faster but query_params currently routes everything through text per params.rs:82. Worth deciding in scope of this issue.
- For
Geography: which Rust geo type is canonical — geo_types::Geometry (already a dependency per DEVELOPMENT.md) or a hyperdb_api-owned newtype?
Summary
ToSqlParamis implemented for primitives,Date/Time/Timestamp/OffsetTimestamp, byte slices, and strings, but not forNumeric,Interval,Geography, or JSON. Users who want to bind these types as query parameters must stringify them by hand — even though the types themselves already round-trip throughIntoValue/RowValueandSqlType::Jsonis a recognized SQL type.Current state
hyperdb-api/src/params.rslists every implementing type starting at line 27. Confirmed missing impls:Existing impls per params.rs:114-416:
i16,i32,i64,f32,f64,boolstr,String,&str,[u8],Vec<u8>Date,Time,Timestamp,OffsetTimestamp&T,Option<T>Original gap analysis: §5 of
docs/RUST_API_GAP_ANALYSIS.md(predecessor repo) — "Interval— exists inIntoValue/RowValuebut notToSqlParam.Numeric— same.Geography— neitherToSqlParamnorIntoValue.serde_json::Value/ native JSON type —SqlType::Jsonexists, but no first-class reader/writer."Proposed work
impl ToSqlParam for Numeric— fixed-precision decimals.impl ToSqlParam for Interval.impl ToSqlParam for Geography(and addIntoValueif missing — the gap analysis flagged that gap too).impl ToSqlParam for serde_json::Value(behind aserde-jsonfeature flag, off by default to avoid pullingserde_jsoninto builds that don't need it).Row::getso users can round-tripserde_json::Valueinstead of stringifying.hyperdb-api/examples/.query_paramsand the inserter path.Backwards compatibility
Purely additive. New trait impls + one new (default-off) feature flag for the
serde_jsonintegration.Open questions
Numeric: bind via the binary encoding path (encode_param) or text (to_sql_literal)? Binary is faster butquery_paramscurrently routes everything through text per params.rs:82. Worth deciding in scope of this issue.Geography: which Rust geo type is canonical —geo_types::Geometry(already a dependency perDEVELOPMENT.md) or ahyperdb_api-owned newtype?