View raw

1 (** Durable {!Repository.S} backed by SQLite through Caqti. The production 2 store. 3 4 All performed facts are stored through {!Codec}. The adapter never inspects 5 domain shape. It stores and returns opaque encoded strings. Prescriptions 6 are not stored. A workout resolves its prescription against the shared 7 {!Catalog} on read. 8 9 Identity is assigned here: trainees and workouts get string ids the adapter 10 mints. *) 11 12 open Hito_app 13 include Repository.S 14 15 exception Corrupt of Codec.error 16 (** Raised when a stored workout cannot be decoded. The cause is a corrupted 17 database, or a catalog that no longer names a stored routine or workout. 18 This is a fault, not a normal outcome. *) 19 20 exception Import_corrupt of Import_codec.error 21 (** Raised when a stored import batch or promoted record cannot be decoded. The 22 cause is a corrupted database, or a catalog that no longer names a stored 23 exercise. This is a fault, not a normal outcome. *) 24 25 val connect : 26 ?pool_config:Caqti_pool_config.t -> string -> (t, Caqti_error.t) result Lwt.t 27 (** [connect uri] opens a connection pool and applies {!Migrations}. [uri] is a 28 Caqti URI such as ["sqlite3:hito.sqlite"]. Use a one-connection pool for 29 ["sqlite3::memory:"] because each connection has a separate database. *) 30