Conversation
rickyrombo
reviewed
May 2, 2025
| WHERE g.grantee_address = @grantee_address | ||
| AND g.is_current = true | ||
| AND g.is_revoked = @is_revoked | ||
| AND sqlc.narg('is_approved')::boolean IS NULL OR g.is_approved = sqlc.narg('is_approved') |
Contributor
There was a problem hiding this comment.
Does this work? If you're casting to a boolean will it ever be null?
Contributor
Author
There was a problem hiding this comment.
I'm also confused by it, but it does appear to work (verified by tests)
rickyrombo
approved these changes
May 2, 2025
schottra
added a commit
that referenced
this pull request
May 6, 2025
Follow on to #65 which implements the managed users endpoint. The query is very similar but it needs to select the user by id and join grants by their wallet address. And the resulting JSON for each record uses `{ user, grant }` instead of `{ manager, grant }`. Fun thing: My original queries were missing parens around the OR clause at the end and that duped me into thinking things were really broken... I also learned that if you put the `IS NULL` check first on a `sqlc.narg()` param, it won't generate the correct type (will give you an `interface {}` instead of a nullable boolean). But if it's last, things work correctly 🤷
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
v1/full/users/:userId/managersendpoint with tests.I'll do the managed users in a separate PR in case there are any big changes requested here. They are very similar in functionality just make the request based on different filters.
The changes in all the other generated files are due to me reinstalling deps and getting a minor version bump on sqlc.