#220 feat: participant scopes over an OR group of columns#265
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Closes #220
"Rows where this principal takes part in any role" is an OR over several columns of the same type, and it was the one query shape that forced raw SQL. It is now a declaration:
list_involving(value, limit, offset)WHERE (requester_id = $1 OR subject_id = $1) ORDER BY id DESC LIMIT $2 OFFSET $3list_handled(parcel_id, value, limit, offset)WHERE parcel_id = $1 AND (requester_id = $2 OR subject_id = $2) …The value is bound once and referenced by every branch.
withinnarrows the group to one parent before the OR. Soft-delete aware, ordered likelist.Checked while parsing: a scope needs at least two columns, every name must be a field of the entity, and the OR-ed columns must agree on their type — one value is bound against all of them, so a mismatch would otherwise surface as a decode error at run time. Two compile-fail cases cover the rejections.
A live-Postgres case proves both forms: both roles match the same principal, narrowing drops the row belonging to another parent, an uninvolved principal matches nothing, and pagination applies. README and the attribute page in all five wiki languages document it.