-
-
Notifications
You must be signed in to change notification settings - Fork 577
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
How to Modify the Result of a PgSelectStep #2161
Comments
Instead of const $resolvedAllocations = applyTransforms(each($allocations, $a => object({
createdAt: $a.get('createdAt'),
updatedAt: $a.get('updatedAt'),
isPrimary: $a.get('isPrimary'),
personRid: $a.get('personRid'),
}))); Not sure if this is what you're looking for? |
This is exactly what I was looking for! Thank you so much. I couldn't find this anywhere in the documentation or code! Think it would be worth it for me to open a PR and add some documentation around this? I think people would find it very useful. |
Yes please; see this issue and the linked discussion for some hints on documenting it: graphile/crystal-pre-merge#416 Also if you get into the documentation mood... there's 27 other issues that could do with some attention - have a look in the "Docs Improvements" column: |
Closing this as I think it's covered by graphile/crystal-pre-merge#416 |
I am in a documentation mood! I took my first stab at writing documentation around this, and if all goes well, will move onto more on that list :) |
I know that
PgSelectStep
is opaque and cannot be fed into another step. I'm thinking this isn't possible but, is there a way to modify the result of this step?Example:
The GraphQL schema we have has some legacy fields. One field, for example, returns the same values as the database, but the key names are slightly different. Such as
is_primary
and is insteadisPrimary
.Right now, we are using a
withPgClient
step to make the same query we would make with aPgSelectStep
in order to have the values of the rows so we can modify the names of the keys.Is there a better way to do this? Thank you :)
In code:
What I want to do:
Then take the result of this and modify it slightly
What we are doing instead:
The text was updated successfully, but these errors were encountered: