Depot.Type
depot/lib/depot_type.march Custom user types for fields whose wire representation (dump) is different from their in-memory representation (load).
A type adapter is just a pair of pure functions: dump : T -> SqlValue — how to send it to the database load : String -> Option(T) — how to parse the text from a result row
Round-trip identity: for any v : T, load(dump(v)) == Some(v).
Two ready-made adapters are provided:
- Email — a trimmed, lowercased string that must contain '@'
- Enum — a list of (march_atom_as_string, db_string) pairs