-
Notifications
You must be signed in to change notification settings - Fork 43
Handle single Join & Where on query helpers #121
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
Conversation
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.
This seems to be another unfortunate Swift parameter pack bug and it's a bummer we need even more overloads to work around it 😕
I think an overload is required per builder, though. Chaining into a having, group(by:), etc., all have the same problem.
It would also be nice to get some compile-time test coverage on these overloads.
Are you down to tackle these issues in this PR? If not we can help finish things up. Took care of it!
stephencelis
left a comment
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.
I wanted to check some of this stuff so I ended up pushing those changes! Brandon and I will discuss and hopefully merge soon. Thanks again for bringing this to our attention 😄
| } | ||
|
|
||
| @Test func singleJoinChaining() { | ||
| let base = Reminder.group(by: \.id).join(ReminderTag.all) { $0.id.eq($1.reminderID) } |
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.
it doesn't test on the actual bug.
it is always working, without patch also working:
Reminder.group(by: \.id).join(ReminderTag.all) { $0.id.eq($1.reminderID) }
tricky is only not working at this case:
Reminder.group(by: \.id).withReminderTagJoin
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.
While this line compiles fine, the lines below it triggered what I think were equivalent compiler errors without the overloads defined in this PR. The issue doesn't seem to be related to the static dynamic member lookup.
|
also, my quick test: |
|
@KayLeung |
* Handle single Join & Where on query helpers * wip --------- Co-authored-by: Stephen Celis <[email protected]>
* Handle single Join & Where on query helpers * wip --------- Co-authored-by: Stephen Celis <[email protected]>
I'm facing the same issue described at
https://github.com/pointfreeco/sharing-grdb/discussions/107
When you join two tables, it becomes a tuple (TableA, SomeOtherTable)
The where method expects the Joins to be a parameter pack (repeat each J)
When you join one table, it return single Table type (not a tuple or empty)?
(Sorry. Not so familiar with Swift. Maybe some better way to handle it)