Investigating handling databases
hamza0867 opened this issue · 0 comments
Hello @yawaramin
Thank you for the great work on this framework. I want to suggest adding the handling databases part to this framework, this way people can use re-web to write their json apis with databases management included. What I think is missing is something like an orm that would make handling requests to the database easy. The approach I am thinking of is to write a ppx that generates code that follows the example found here.
We will have a module that represents our Entity and the usage of the ppx can be something like:
module Entity = [%reweb.entity
type t = {
id: int,
title: string,
completed: bool,
}
]
and then the ppx will generate the whole module Entity found in the example.
And for the Repository module I still don't have a clear idea on how to do it because the repository needs to get the connection pool from somwhere. So maybe some combination of a functor with a ppx, the functor to inject the connection pool and the ppx to generate the remaining code ?
I would like to hear your thoughts on this.