-
Notifications
You must be signed in to change notification settings - Fork 70
Like operator #137
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
Like operator #137
Conversation
Codecov Report
@@ Coverage Diff @@
## master #137 +/- ##
==========================================
- Coverage 80.37% 80.22% -0.15%
==========================================
Files 15 15
Lines 2787 2792 +5
==========================================
Hits 2240 2240
- Misses 375 380 +5
Partials 172 172
Continue to review full report at Codecov.
|
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.
Thank you for the contribution!
I'd like to ask you though for a few small changes just to keep this operator consistent with the existing ones.
tests/query_test.go
Outdated
s.Equal("bar", store.MustFindOne(queryErr).Foo) | ||
}) | ||
|
||
foobar := newQueryFixture("foo bar") |
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, move the operators tests to this test for consistency https://github.com/src-d/go-kallax/blob/master/operators_test.go#L34
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.
Initially, I tried to run operators_test.go
inside of my forked repo folder, but I always get can't load package: package github.com/jorbs/go-kallax: code in directory ~/go/src/github.com/jorbs/go-kallax expects import "gopkg.in/src-d/go-kallax.v1"
. I'm new on Go lang, but I think the packages are fixed to the original repo (github.com/src-d/go-kallax).
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.
Yes, they are fixed to gopkg.in/src-d/go-kallax.v1
. What you can do is clone the repo at $GOPATH/src/gopkg.in/src-d/go-kallax.v1
and add your own remote there. Unfortunately, until real package management is a thing in Go, we have to stick with such methodologies.
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 got it. Thanks.
values []interface{} | ||
} | ||
|
||
like struct { |
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.
there's no need for a new struct, actually, there is colOp
for that https://github.com/src-d/go-kallax/blob/master/operators.go#L286
// See https://www.postgresql.org/docs/9.6/static/functions-matching.html. | ||
func Like(col SchemaField, value string) Condition { | ||
return func(schema Schema) squirrel.Sqlizer { | ||
return like{col.QualifiedName(schema), 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.
Use colOp
instead of custom type https://github.com/src-d/go-kallax/blob/master/operators.go#L106
Thanks! LGTM. Can you remove the commit |
Don't worry, I already cherrypicked the commit and pushed it. Thanks! |
No description provided.