jeremydaly / data-api-client

A "DocumentClient" for the Amazon Aurora Serverless Data API
MIT License
439 stars 61 forks source link

Support for `array_agg` queries #80

Open jcsturges opened 3 years ago

jcsturges commented 3 years ago

Love this project @jeremydaly !!!

I have a set of queries where I join 2-3 tables together and rely on the built-in PostgreSQL functions for array_agg to collect array properties. This doesn't appear to be supported yet but it would be awesome if the result set parser could handle this.

Example query:

SELECT users.id, array_agg(memberships.id) AS audienceIds
FROM users
LEFT OUTER JOIN memberships ON users.id = memberships.user_id
GROUP BY users.id

Returns:

{ "id": 1, "audienceIds": { "longValues": [1, 2, 3] } }

Expected:

{ "id": 1, "audienceIds": [1, 2, 3] }

I'm working on a pretty meaty project for the next few weeks but if I free up I'm happy attempt a PR. Seems like it should be relatively simple.