blob: 807289ae496ffcdaa082592084079729cef2bfc1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
(** Common fuctions shared between the tests *)
let ( let* ) = Lwt.bind
(** Connect to the database in memory and create a schema matching the given
configuration *)
let connect : Configuration.Ast.setting -> Caqti_lwt.connection Lwt.t =
fun conf ->
let* conn = Caqti_lwt_unix.connect (Uri.of_string "sqlite3::memory:") in
let* db = Caqti_lwt.or_fail conn in
let module Db = (val db) in
let* () = Query.create db conf in
Lwt.return db
|