package sihl

  1. Overview
  2. Docs

Module type Rest.SERVICESource

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

Sourcetype t

t is the type of the resource.

Sourceval find : string -> t option Lwt.t

find id returns t if it is found.

Sourceval query : unit -> t list Lwt.t

query () returns a list of t.

Sourceval 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.

Sourceval update : string -> t -> (t, string) 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.

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

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