package sihl

  1. Overview
  2. Docs

The SERVICE interface has to be implemented by a CRUD service that drives the resource with its business logic.

type t

t is the type of the resource.

val find : string -> t option Lwt.t

find id returns t if it is found.

val query : unit -> t list Lwt.t

query () returns a list of t.

val insert : t -> (t, string) Result.t Lwt.t

insert t inserts t and returns an error message that can be shown to the user if it fails.

val update : string -> t -> (t, string) Stdlib.result Lwt.t

update id t updates the t that is found using its id with t and returns an error message that can be shown to the user if it fails.

This function is similar to insert and it overwrites an existing t.

val delete : t -> (unit, string) Stdlib.result Lwt.t

delete t deletes t and returns an error message that can be shown to the user if it fails.

OCaml

Innovation. Community. Security.