-
Notifications
You must be signed in to change notification settings - Fork 157
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
Support contains operator for MySQL #2042
Conversation
Code coverage for golang is
|
pkg/datastore/mysql/query.go
Outdated
@@ -74,6 +74,8 @@ func buildWhereClause(filters []datastore.ListFilter) string { | |||
// Make string of (?,...) which contains the number of `?` equal to the element number of filter.Value | |||
valLength := reflect.ValueOf(filter.Value).Len() | |||
conds[i] = fmt.Sprintf("%s %s (?%s)", filter.Field, filter.Operator, strings.Repeat(",?", valLength-1)) | |||
case "JSON_CONTAINS": | |||
conds[i] = fmt.Sprintf("%s(%s, '%q', '$')", filter.Operator, filter.Field, filter.Value) |
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.
We shouldn't pass the filter.Value
here, it will automatically be passed by here, what we do here is to make the string query that mark every value on the query as ?
character. 😄
hmm, it's killing me that it takes a bit long time to reflect on the local environment every time I change the code, and plus i wonder if it really reflects the changes. i'm in the middle of looking up what's going on. |
Code coverage for golang is
|
Okay, first of all, for embed files, it turns out they don't get updated with |
I didn't know that 👀 I'm using docker4mac k8s cluster instead of |
I see. Let me talk about it in the near future. |
Indexing on a JSON column didn't go well. Though I'm in the middle of trying to do it, the query works fine without the index. |
Sorry, hold on |
Code coverage for golang is
|
/hold cancel |
Code coverage for golang is
|
@@ -74,6 +74,8 @@ func buildWhereClause(filters []datastore.ListFilter) string { | |||
// Make string of (?,...) which contains the number of `?` equal to the element number of filter.Value | |||
valLength := reflect.ValueOf(filter.Value).Len() | |||
conds[i] = fmt.Sprintf("%s %s (?%s)", filter.Field, filter.Operator, strings.Repeat(",?", valLength-1)) | |||
case "MEMBER OF": | |||
conds[i] = fmt.Sprintf("? %s (%s)", filter.Operator, filter.Field) |
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.
Please add test for this in query_test.go/TestBuildFindQuery 😁
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.
Right right
**What this PR does / why we need it**: To prevent further casualties... Ref: #2042 (comment) **Which issue(s) this PR fixes**: **Does this PR introduce a user-facing change?**: <!-- If no, just write "NONE" in the release-note block below. --> ```release-note NONE ``` This PR was merged by Kapetanios.
The following ISSUES will be created once got merged. If you want me to skip creating the issue, you can use Details1. Create index on ProjectId and EnvIdsThis was created by todo plugin since "TODO:" was found in c01c30d when #2042 was merged. cc: @nakabonne. |
PTAL ;) |
Way to go 🙌 |
Code coverage for golang is
|
/approve |
What this PR does / why we need it:
Indexing on a JSON column didn't go well. Though I'm in the middle of trying to do it, the query works fine without the index.
Let me merge it to support the environment deletion feature in the next version. It's no problem to add index after that version.
Which issue(s) this PR fixes:
Fixes #2033
Does this PR introduce a user-facing change?: