Minimal SQLite key-value store for OCaml
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-linkedin: apply dune fmt

Pure formatting changes from `dune fmt`: doc comment placement moves
from above the binding to below it for `type`s, multi-line `match`
expressions collapse onto one line where they fit, and infix operator
applications pick up spaces (`Soup.($?)` -> `Soup.( $? )`). No
semantic changes.

+14 -5
+14 -5
README.md
··· 13 13 14 14 ## Installation 15 15 16 + Install with opam: 17 + 18 + ```sh 19 + $ opam install sqlite 16 20 ``` 17 - opam install sqlite 21 + 22 + If opam cannot find the package, it may not yet be released in the public 23 + `opam-repository`. Add the overlay repository, then install it: 24 + 25 + ```sh 26 + $ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git 27 + $ opam update 28 + $ opam install sqlite 18 29 ``` 19 30 20 31 ## Usage ··· 22 33 ```ocaml 23 34 (* Open or create a database *) 24 35 Eio.Switch.run @@ fun sw -> 25 - let db = Sqlite.open_ ~sw (Eio.Path.(fs / "data.db")) in 26 - 36 + let db = Sqlite.open_ ~sw (Eio.Path.(fs / "data.db")) 27 37 (* Basic key-value operations *) 28 38 Sqlite.put db "key1" "value1"; 29 39 let value = Sqlite.find db "key1" in (* Some "value1" *) 30 40 31 41 (* Namespaced tables *) 32 - let blocks = Sqlite.Table.create db ~name:"blocks" in 33 - Sqlite.Table.put blocks "cid1" "data1"; 42 + let blocks = Sqlite.Table.create db ~name:"blocks"Sqlite.Table.put blocks "cid1" "data1"; 34 43 35 44 (* Sync to disk *) 36 45 Sqlite.sync db;