package sihl
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=bfa7bde9af02bb83d5ca39d54797b05b43317f033d93d24ca86ca42ff8ef83a1
sha512=6bb8727f65116e8042aa1fb77b3c14851ce5238f7b412adadf0f8e5b52d5310e8f06056c96bf76a82ffd7096753f49b2b0482f41e18ee1ca94310b874fe81bf9
doc/sihl.repository/Repository/index.html
Module Repository
Source
The repository service deals with cleaning repositories. This is useful for integration tests.
Installation
Use the provided Sihl.Repository.Service.Make
to instantiate a repo service.
module Repo = Sihl.Repository.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
module Sig : sig ... end