Available on crate features
sink-spanner or source-spanner only.Expand description
Generic Spanner row → serde_json::Value decoding.
faucet sources run arbitrary user SQL, so rows must decode without a
compile-time schema. SpannerJson implements the client’s
TryFromValue hook, which hands us the raw protobuf value plus the
column’s full Type metadata — enough to decode every Spanner type
into faithful JSON:
| Spanner | JSON |
|---|---|
| INT64 / ENUM | integer (lossless — arrives string-encoded) |
| FLOAT64 / FLOAT32 | number (NaN/Infinity → string) |
| BOOL | boolean |
| STRING / TIMESTAMP / DATE / UUID / INTERVAL | string |
| BYTES / PROTO | base64 string (as transmitted) |
| NUMERIC | string (precision preserved) |
| JSON | parsed object/array/scalar |
| ARRAY | array (element type recursed) |
| STRUCT | object keyed by field name |
Structs§
- Spanner
Json - Newtype decoding one Spanner column into a
serde_json::Value.
Functions§
- decode_
value - Decode one protobuf value with its (possibly absent) Spanner type.
- row_
to_ json - Decode a whole
Rowinto a JSON object keyed by column name, using the stream’s column metadata (RowIterator::columns_metadata).