Closed roddyyaga closed 4 years ago
Heads up for any ppx_rapper users: I'm planning on reordering the signature of generated queries by moving the connection parameter.
let update = [%rapper execute {sql| UPDATE things SET value = %string{value} WHERE id = %int{id} |sql} record_in]
will go from having type
(module Caqti_lwt.CONNECTION) -> {id: int; value: string} -> (unit, [> Caqti_error.call_or_retrieve ]) result Lwt.t
to
{id: int; value: string} -> (module Caqti_lwt.CONNECTION) -> (unit, [> Caqti_error.call_or_retrieve ]) result Lwt.t
This is to make using queries with connection pools nicer. With a function execute defined as
execute
let execute query = Caqti_lwt.Pool.use query pool
you will be able to do
let calls_update { id; value } = execute @@ update { id; key; value; account_id }
rather than
let calls_update { id; value } = execute @@ fun conn -> update conn { id; key; value; account_id }
Please let me know if this would cause any problems for you (other than having to update affected code).
I like this change
@hamza0867 It's in version 2.0!
Heads up for any ppx_rapper users: I'm planning on reordering the signature of generated queries by moving the connection parameter.
will go from having type
to
This is to make using queries with connection pools nicer. With a function
execute
defined asyou will be able to do
rather than
Please let me know if this would cause any problems for you (other than having to update affected code).