-
-
Notifications
You must be signed in to change notification settings - Fork 576
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 update column value with mutation to NULL #108
Comments
One possible solution is to add boolean fields into |
This definitely looks like a bug. I'll investigate 👍 |
@calebmer Can you point out some relevant pieces of code for me? I can prepare PR for this, but I feel there will be more discussion about this... So, any ideas? I really want this feature 😈 |
For sure 😊 This statement will be what you want to look at. Also, here where Also a quick crash-course on The bug may be here or it may be as easy a fix as changing this to: if (value === null) {
setClauses.push(`"${column.name}" = null`)
}
else {
setClauses.push(`"${column.name}" = $`)
setValues.push(value)
} ( Let me know how it goes 👍 🎉 |
Thanks! Will look. Btw do you like way I'm using template strings in my pg-async library? |
It depends, how much do you support? 😉 I didn’t see any documentation when I looked quickly. I really don’t like Some requirements for a SQL builder used by PostGraphQL is:
The implementation I landed on is also pretty fast. At the end of the days it’s just some string concatenation. Under the hood everything is an object though, it takes the strings and turns it into an array, so a query like: sql.query`where ${sql.identifier('a', 'b', 'c')} = ${sql.value(value)}` Turns into: [{ type: 'RAW', text: 'where ' }, { type: 'IDENTIFIER', names: ['a', 'b', 'c'] }, { type: 'RAW', text: ' = ' }, { type: 'VALUE', value: value }] I really like the API/implementation I ended up with, but I’m always open to new ideas 😊 |
After some more research, I remembered that there is no idea of “null” for inputs in GraphQL. See this issue graphql/graphql-js#133 and this RFC pull request graphql/graphql-spec#83 For now if you want to continue with your proposal ( Another option is we could add a |
Hi. I just finished new PR graphql/graphql-js#544 extending GraphQL with But it looks that null values are supported already in graphql-js@master. What is state of this issue? Are explicit nulls still unhandled? |
I’ve been watching the progress, great job 😊 I’ll have to check and see if |
Looks like graphql/graphql-js#544 just got merged! |
🎉 now just waiting for it to get released in Also see #202 |
@calebmer what is the status of this? |
@ferdinandsalis I can confirm this works, just make sure you have a version of GraphQL above Submit a PR to add tests and prevent regression, once that gets merged we can close this issue: #255 |
Hi @calebmer. I'm challenging problem. How I can set value to
NULL
?The text was updated successfully, but these errors were encountered: