Dynamic query parts based on user input
Based on certain user input (REST API), I need to filter and/or sort by provided fields.
This could mean that some joins need to be added as well.
The fields to filter and sort are not always a 1-1 mapping to a database column, the names can deviate.
I came of with a mapping like:
and this is an example case of how to use it:
above is just for illustration, in fact the call will be something like:
and this works!
But the thing is it depends havily on the
Kylesy itself does a tremendous job about type safety.
Is there a way to make that
This could mean that some joins need to be added as well.
The fields to filter and sort are not always a 1-1 mapping to a database column, the names can deviate.
I came of with a mapping like:
and this is an example case of how to use it:
above is just for illustration, in fact the call will be something like:
and this works!
But the thing is it depends havily on the
sql tag, so none is typesafe unfortuantely.Kylesy itself does a tremendous job about type safety.
Is there a way to make that
queryFields with the joins type safe? e.g. with helper methods?