All persistence needs should be compatible with either SQLite, PostgreSQL or Elasticsearch. The proposed structure is that of a mapping between types (e.g. TemplateGraph.t, TemplateGraph.Node.t, etc.) and a dispatch-based function for each CRUD requirement.
let save: (Settings.t, TemplateGraph.t) => Lwt.t(TemplateGraph.t);
let read: (Settings.t, string) => Lwt.t(option(TemplateGraph.t));
let delete: (Settings.t, string) => Lwt.t(unit);
All these should be implemented at the service level, with general helpers located elsewhere.
All persistence needs should be compatible with either SQLite, PostgreSQL or Elasticsearch. The proposed structure is that of a mapping between types (e.g.
TemplateGraph.t,TemplateGraph.Node.t, etc.) and a dispatch-based function for each CRUD requirement.All these should be implemented at the service level, with general helpers located elsewhere.