Taking a look at the code, it seems that your run()
function is no problem since it’s returning a record type.
However the runArray()
function is the challenge since that’s where you’re using a tuple to model the array that’s returned from the database (and provide a type for each array element).
Just a few thoughts:
It might be worth considering if you need to support the array API. Since your target audience for this generated code is ReScript developers, then maybe the record type is all that’s needed and avoid the awkwardness of an array that contains different types.
If you feel it’s useful to support the array/tuple, then, from what I’ve seen in ReScript code, it’s common to just return a single value immediately when only one value is needed, but return a tuple when 2 or more values are needed. For the single value version you’ll need to transform the array provided by the database into the single value.