-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support json_agg(column_ref) #1316
Support json_agg(column_ref) #1316
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Open in Stackblitz • kysely_koa_example
commit: |
Since it's likely that people will use this functionality with |
6be68bc
to
63ce1a6
Compare
Hey 👋 Thanks! 💪
I'll need to think about the helper. You're right about the usage pattern due to nullability.
(eb) => eb.coalesce(eb.jsonAgg("col"), sql<string[]>`[]`) vs. import { someHelper } from 'kysely/helpers/postgres'
(eb) => someHelper(eb.ref("col")) The existing helpers were born out of a LOT of signals from the community needing something after they ditched some ORM and did not know how to do nested stuff with SQL. Regardless, this shouldn't be part of this PR. |
This could really use a unit test. |
Could you assist me in writing a unit test? What unit do you think should be tested though not to make it an integration test? |
Sure. We could also pair up on this if you want (DM on Discord). We have a suite for aggregate functions, probably there. |
bcad8af
to
406342d
Compare
@igalklebanov I've just taken some time to look at writing a unit test - it was not as hard as I assumed. Is this how you envisioned it? I saw that you rebased my PR on the branch |
406342d
to
a7cd07b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@igalklebanov I've just taken some time to look at writing a unit test - it was not as hard as I assumed. Is this how you envisioned it?
Yeah, looks good. Most times there's also a sql output check between execution and query, but I see this suite doesn't do these so it's fine.
I saw that you rebased my PR on the branch 0.28, which had some tests failing - at least at the stage it was back then. Now, as I've rebased it on master, all tests run through.
Yeah since this PR introduces new functionality, we wanna keep it out of any documentation so it's parked in the next major release branch.
Co-authored-by: Simon Schick <[email protected]> Co-authored-by: Igal Klebanov <[email protected]>
Co-authored-by: Simon Schick <[email protected]> Co-authored-by: Igal Klebanov <[email protected]>
Fixes #1280.
Wow, my first PR in this repo 🤩
If there was something wrong about what I wrote - e.g. if the types are too narrow or wide, please let me know.
Here's what I know about this:
According to the docs, this method does only exist for Postgresql, and I therefore didn't look into any other of the options.