From 7585d7bf8d5104b2594de91db4c2cab57adce694 Mon Sep 17 00:00:00 2001 From: Thomas Gazagnaire Date: Thu, 15 Oct 2026 14:55:24 +0200 Subject: [PATCH] catalog: run the README query over the in-memory store The usage example defined a query and never ran it, so nothing checked what it answers. --- ocaml-catalog/README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ocaml-catalog/README.md b/ocaml-catalog/README.md index f442e612a5..9bf581e99b 100644 --- a/ocaml-catalog/README.md +++ b/ocaml-catalog/README.md @@ -66,8 +66,19 @@ let adults db = ``` `Catalog.insert`, `Catalog.update` and `Catalog.delete` write through the same -table declarations. To try the library, `Catalog.of_mem` builds a catalog -over the in-memory reference store. +table declarations. `Catalog.of_mem` builds a catalog over the in-memory +reference store, which is enough to run the query: + +```ocaml +let db = + Catalog.of_mem + [ ("users", { Catalog.Spi.Mem.columns = [ "id"; "name" ]; rows = [] }) ] + +let () = + Catalog.insert db users { id = 7L; name = "alice" }; + Catalog.insert db users { id = 42L; name = "bob" }; + assert (List.map (fun u -> u.name) (adults db) = [ "bob" ]) +``` ## API -- knotmirror 0.0.1