-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fixes Parent Relation Lookups #47
Conversation
filter.go
Outdated
return false | ||
} | ||
for i, childMatchValue := range childMatchValues { | ||
if childMatchValue.Interface() != parentMatchValues[i].Interface() { |
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've made this mistake before but we probably shouldn't compare the underlying values through Interface(). It will panic if one of the values is a zero value. Also if childMatchValue.IsValid()
is false (a zero value), then we should return false.
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.
Good catch, What do you think about checking "CanInterface" first. I think that should work.
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.
Even better!
Found a few bugs in the parent relation lookups. This should fix them.