package sihl
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=eac58e5ee9c869aa3b0f0bcee936b01c53bf7fe1febb42edd607268dfb11f4e9
sha512=012b6cf1cf6af0966059761b4916ea8aa590aa8d5809a6f480cb17e23ee10c3b9245062c4f0cf9ad98ab950391c0827c9780999d39fa16a93f7aab4b12f9ab8c
doc/sihl.data/Data/Repo/index.html
Module Data.Repo
Source
The repository service deals with cleaning repositories. This is useful for integration tests.
Installation
Use the provided Sihl.Data.Repo.Service.Make
to instantiate a repo service.
module Repo = Sihl.Data.Repo.Service.Make ()
Usage
You typically want to use the repo service in your own repositories in order to register repository cleaners. This allows Sihl to reset the state of your system after integration tests.
{ let cleaner = ... in Repo.register_cleaer cleaner; }
In order to clean all repositories that have registered cleaners you can call clean_all
:
{ open Lwt.Syntax let* () = Repo.clean_all ctx in .. }
Repositories can return meta data containing information like total rows affected. This can be useful for pagination.
This module can be used to assemble dynamic repository queries. This is typically used if you don't know the number of parameters at compile time because they are provided by the user, for instance as a filter or sort. http://paurkedal.github.io/ocaml-caqti/caqti/Caqti_request/index.html#how-to-dynamically-assemble-queries-and-parameters