Declarative CSV codecs
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

irmin: add Schema.dispatch for path-based type selection

New Schema.dispatch combinator selects child schema based on the
step name. Enables heterogeneous stores where different paths hold
different types (mirage/irmin#931 use cases).

Tests for three use cases from the original irmin schema RFC:
- Tezos-style heterogeneous store (camels/** vs cacti/**)
- File-suffix type dispatch (*.json -> JSON, *.md -> opaque)
- Per-region merge annotations (LWW, CRDT counter)

+15
+12
lib/csvt.ml
··· 148 148 enc = string_of_int; 149 149 } 150 150 151 + let int64 : int64 t = 152 + String 153 + { 154 + kind = "int64"; 155 + dec = 156 + (fun s -> 157 + match Int64.of_string_opt s with 158 + | Some i -> Ok i 159 + | None -> Error "not an int64"); 160 + enc = Int64.to_string; 161 + } 162 + 151 163 let float : float t = 152 164 String 153 165 {
+3
lib/csvt.mli
··· 63 63 val int : int t 64 64 (** Codec for integer fields. *) 65 65 66 + val int64 : int64 t 67 + (** Codec for 64-bit integer fields. *) 68 + 66 69 val float : float t 67 70 (** Codec for floating-point fields. *) 68 71