paurkedal / ocaml-caqti

Cooperative-threaded access to relational data
https://paurkedal.github.io/ocaml-caqti/index.html
GNU Lesser General Public License v3.0
299 stars 36 forks source link

Support for larger tuple sizes #100

Closed mooreryan closed 1 year ago

mooreryan commented 1 year ago

In #36, the question was asked about how to work with arbitrary tuple sizes. Summarizing that issue, the current way to work with tuples larger than four seems to be

Is there a technical reason not to support tuples larger than 4 directly? Chaining tup2 string (tup2 string (tup2 string ... when you have to work a lot of values/columns in a request/response doesn't feel so nice. (Of course, what feels nice is subjective.)

mooreryan commented 1 year ago

Follow up question, would you accept a pull request that adds those two methods of dealing with larger tuples to the mli docs? Currently it just says:

to describe wider tuple types, use nested application.

paurkedal commented 1 year ago

The reason for the restriction is that there is duplication of code in the drivers involving these tuples which I have kept there for performance reasons. However, revisiting this I realise we can use the custom type to implement more cases (with slight performance penalty). I'll commit support for up to 8 in a moment.

mooreryan commented 1 year ago

Thanks!