Option to return results as a list, instead of a map
The request may be:
{
"resultFormat": "list",
"transaction": [{
"query": "SELECT * FROM folders",
...
}, ...]
...
with values of list or map, by default/if absent map would be used, for retrocompatibility. If list, your result would become:
{
"results": [
{
"success": true,
"resultHeaders": ["id", "name", "position", "updated_at", "created_at"],
"resultSet": [
[ "default", "Default", 0.0, "2024-02-04 12:23:08", "2024-02-04 12:23:08" ]
]
}
]
}
The new node resultHeaders would always be displayed, even in maps: currently there's no way to tell the column order, and this would give it.
I thought about this a bit, and maybe instead of returning the data in resultSet, you can return it in another field (resultList or something else). I feel like this can simplify the code since Go's typing is a good guard rail, but sometimes it is not flexible enough.
At first glance, I don't like it... but actually, polymorphism (one key, more than one format, I mean) is not a good idea anyway. Let me think about it.
I thought about this a bit, and maybe instead of returning the data in
resultSet, you can return it in another field (resultListor something else). I feel like this can simplify the code since Go's typing is a good guard rail, but sometimes it is not flexible enough.
Yep, done it. Thanks.