kiranandcode / petrol

Petrol's an OCaml SQL API made to go FAST.
https://kiranandcode.github.io/petrol/petrol/index.html
Other
113 stars 6 forks source link

Abstract lwt out of core petrol to unblock eio/async integration #7

Open dangdennis opened 1 year ago

dangdennis commented 1 year ago

Changes

Resolves #2

This is more a POC to have something tangible to discuss. So I've made some changes to make development easier. See the notes section.

The goal is to isolate petrol's lwt api to a separate package so users of petrol can use it with async, lwt, or eio, or maybe even with ocaml 5's threads/domains.

I'm not enough of a wizard to figure out how to create a module or functor such that we can only write petrol's apis once and merely pass along a generic Caqti connection. So I extracted all of petrol's lwt stuff into its own petrol_lwt package.

I renamed lib/ to petrol/.

Notes

I temporarily deleted petrol.mli to expose all of petrol's interface to allow petrol_lwt access to the necessary modules like Types and parts of Request. I'd like help here to expose the correct Request interface for petrol_lwt so we can keep your well-documented interface file.

I used .ocamlformat as a quick means of formatting during development. I can remove later and revert petrol.ml to whatever style you've had.

dangdennis commented 1 year ago

Please feel free to edit directly in this PR if you have time. I'll be working on a branch downstack this one to continue the eio experiment.