-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
Vinai/json contains #401
Vinai/json contains #401
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.
Overall looks good, but I've mentioned this pointer receiver issue before.
} | ||
|
||
// FunctionName implements sql.FunctionExpression | ||
func (j JSONContains) FunctionName() string { | ||
return "json_contains" | ||
} | ||
|
||
func (j JSONContains) Resolved() bool { |
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.
All of these need to be pointer receivers. If you're checking that you're implementing an interface via a pointer (var _ sql.FunctionExpression = (*JSONContains)(nil)
here) and returning a pointer from New
, then all of your functions should be pointers as well.
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.
Totally my bad. Will be more cautious next time
return []sql.Expression{j.JSONTarget, j.JSONCandidate} | ||
} | ||
|
||
func (j JSONContains) WithChildren(children ...sql.Expression) (sql.Expression, error) { |
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.
Check if the count is the same. If you sent out 3 expressions in Children
, then you should have 3 here too.
Adds the json_contains function