Story: Modernise serialisation and storage
Table of Contents
This page documents a story in Sprint 02. It captures the goal, current status, acceptance criteria, and the tasks that compose it.
Goal
Replace the hand-written serialisation and storage layers with generated ones, so adding new data types is cheap. Reflect-cpp covers JSON and XML; sqlgen covers Postgres.
Status
| Field | Value |
|---|---|
| State | DONE |
| Parent sprint | Sprint 02 |
| Now | Story closed; reflect-cpp drives JSON and XML, sqlgen replaces hand-written Postgres adapters. |
| Waiting on | None. |
| Next | None. |
| Last touched | 2025-10-10 |
Acceptance
- Reflect-cpp generates JSON serialisers for the existing types.
- XML parsing now goes through reflect-cpp.
- Postgres CRUD goes through sqlgen-generated code.
- Round-trip tests pass for all migrated types.
Tasks
| Task | State | Start | End | Description |
|---|---|---|---|---|
| Add serialisation support for reflect-cpp | DONE | 2025-09-22 | 2025-09-28 | Integrate reflect-cpp into the build and use it to generate JSON serialisers for the existing types. |
| Replace XML parsing with reflect-cpp | DONE | 2025-09-29 | 2025-10-05 | Replace the hand-rolled XML parsing path with reflect-cpp's XML codec. |
| Use sqlgen for Postgres | DONE | 2025-10-05 | 2025-10-10 | Replace hand-written Postgres CRUD with sqlgen-generated code. |
Decisions
- Reflect-cpp over Boost.PFR + manual
- reflect-cpp gives us bidirectional codecs for both JSON and XML in one library; the Boost.PFR approach would have needed a second library for XML.
- Sqlgen over hand-rolled prepared statements
- keeps the schema shape and the C++ types in sync without manual marshalling.
Out of scope
- Migration of the entire codebase to sqlgen — only the active types in v0 are converted.
- Performance benchmarking of the generated code.
See also
- ores.codegen — the code generator that this work fed into
(reflect-cpp and sqlgen sit alongside it in
library/templates/). - ores.codegen architecture — knowledge doc for the codegen internals.
- ores.sql — the Postgres setup sqlgen targets.