Skip to content
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

Merged
merged 11 commits into from
May 4, 2021
Merged

Vinai/json contains #401

merged 11 commits into from
May 4, 2021

Conversation

VinaiRachakonda
Copy link
Contributor

@VinaiRachakonda VinaiRachakonda commented May 3, 2021

Adds the json_contains function

@VinaiRachakonda VinaiRachakonda requested review from Hydrocharged and removed request for Hydrocharged May 3, 2021 23:06
Copy link
Contributor

@Hydrocharged Hydrocharged left a 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 {
Copy link
Contributor

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.

Copy link
Contributor Author

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) {
Copy link
Contributor

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.

@VinaiRachakonda VinaiRachakonda merged commit 622effe into master May 4, 2021
@Hydrocharged Hydrocharged deleted the vinai/json_contains branch December 8, 2021 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants