Shameless self plug, but I’ve built pgtyped-rescript
(a ReScript fork of pgtyped
) which I use in a lot of projects: pgtyped-rescript/RESCRIPT.md at rescript · zth/pgtyped-rescript · GitHub
Let’s you write SQL code inline in a type safe way (types are generated from the SQL and your DB):
let query = %sql.one(`
SELECT * FROM books WHERE id = :id!
`)
let res = await client->query({id: 1})
// Typed according to the SQL 1query
Console.log(res)