[ANN] Petrol 1.0.0 - A high-level typed SQL API for OCaml designed to go fast!

If I’m understanding right, you want the database to somehow encode the same level of constraints/rules/variants that your domain has. Right? If so, yeah you’re right that no databases have the same level of features to model what you expect to do in ocaml.

I separate my domain logic from my storage code, and have a layer in b/t to convert domain, parsed, validated data into sql and back. At the database level, I’ll do the best I can to design invariants as much as I can but it’s impossible to have it perfect.

sql / external data is parsed → domain
domain → transformed → sql

Nvm, with this statement, you’re talking about reading your in-memory records via sql syntax. That sounds tough. I would think it’s just fast enough to read directly from sql.

Also saw the other thread now. I’ll just leave this here for now.