-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat(datastore): EntityFilter for AND/OR queries #7589
Conversation
datastore/query.go
Outdated
Filters []EntityFilter | ||
} | ||
|
||
func (OR) isCompositeFilter() {} |
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.
suggestion: it looks like this method is only used to satisfy the CompositeFilter interface above. Same with AND below. Seems to me that you should be able to have both OR and AND structs fulfill the same interface without creating a dummy method. Try to remove isCompositeFilter()
.
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.
On removing, I see error:
cannot use &OR{…} (value of type *OR) as CompositeFilter value in struct literal: *OR does not implement CompositeFilter (missing method isCompositeFilter)
return nil, errors.New("datastore: empty query filter field name") | ||
} | ||
v, err := interfaceToProto(reflect.ValueOf(qf.Value).Interface(), false) | ||
pbFilter, err := qf.toProto() |
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.
praise: Nice refactor here!
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.
Looks good!
@bhshkh When you're ready for another round of reviews, just "Re-Request Review" on the side panel above and I'll take a look. |
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.
A couple of minor nits, but big picture looks great.
Adding new method 'FilterEntity' to Query which can be used to construct composite queries.
Adding the following new structs to be used with FilterEntity