-
Notifications
You must be signed in to change notification settings - Fork 181
Add ILIKE functionality #194
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
Conversation
Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test." |
Can one of the admins verify this patch? |
2 similar comments
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can you add some tests to verify your changes and prevent regressions in the future? |
Yes, I will add a few test in the next few days. |
@alireza-ahmadi any news on this? |
@zbarbuto @superkhau I have added a few tests for the added feature. Also because I couldn't find the required test for Please let me know if the tests don't have a good coverage or any other changes needed. |
4f2c0d6
to
3cb3fa1
Compare
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 LGTM, a few minor nits to fix and we can land this. ;)
test/postgresql.test.js
Outdated
function(done) { | ||
Post.find({where: {content: {like: '%TestCase%'}}}, | ||
function(err, posts) { | ||
should.not.exists(err); |
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.
if (err) return done(err);
for better stack traces
test/postgresql.test.js
Outdated
Post.destroyAll(done); | ||
}); | ||
|
||
it('should support case sensitive queries using like', |
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.
it('supports case sensi...
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, I see the other tests are different (we need to eventually update all of them to this style over time
test/postgresql.test.js
Outdated
}); | ||
}); | ||
|
||
it('should not support case insensitive queries using like', |
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.
ditto
test/postgresql.test.js
Outdated
function(done) { | ||
Post.find({where: {content: {like: '%tesTcasE%'}}}, | ||
function(err, posts) { | ||
should.not.exists(err); |
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.
ditto
test/postgresql.test.js
Outdated
}); | ||
}); | ||
|
||
it('should support like for no match', function(done) { |
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.
ditto
test/postgresql.test.js
Outdated
it('should support ilike for no match', function(done) { | ||
Post.find({where: {content: {ilike: '%tesTxasE%'}}}, | ||
function(err, posts) { | ||
should.not.exists(err); |
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.
ditto
test/postgresql.test.js
Outdated
}); | ||
}); | ||
|
||
it('should support negative case insensitive queries using nilike', |
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.
ditto
test/postgresql.test.js
Outdated
function(done) { | ||
Post.find({where: {content: {nilike: '%casE%'}}}, | ||
function(err, posts) { | ||
should.not.exist(err); |
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.
ditto
test/postgresql.test.js
Outdated
}); | ||
}); | ||
|
||
it('should support nilike for no match', function(done) { |
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.
ditto
test/postgresql.test.js
Outdated
it('should support nilike for no match', function(done) { | ||
Post.find({where: {content: {nilike: '%tesTxasE%'}}}, | ||
function(err, posts) { | ||
should.not.exists(err); |
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.
ditto
@superkhau Thanks for the review, I have applied the requested changes. Please let me know if any other changes required. |
@slnode test please |
0db8b34
to
91c7a05
Compare
test/postgresql.test.js
Outdated
}); | ||
after(function deleteTestFixtures(done) { | ||
Post.destroyAll(done); | ||
}); |
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.
You can remove the after since we delete in the before already
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.
@superkhau Thanks for the review. I will apply these changes, rebase, and push the changes in the next few minutes.
test/postgresql.test.js
Outdated
title: 't2', | ||
content: 'T2_TheOtherCase', | ||
}], done); | ||
}); |
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.
You can move the two functions to the bottom of the context block:
before(deleteTestFixtures);
before(createTestFixtures);
it('...');
it('...');
...
function deleteTestFixtures(done) {
Post.destroyAll(done);
}
function create...
http://loopback.io//doc/en/contrib/style-guide.html#layout-of-test-files
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.
Approved with my last suggested fixed.
@kjdelisle Reassigning to your squad. |
eb6489a
to
c9bade4
Compare
- Change test descriptions to match the new style - Change error handling mechanism for better stack traces
c9bade4
to
7f3b4d6
Compare
I have applied the requested code style changes(and a typo in |
Let's wait for CI to pass, should be good to land. TY for the contribution BTW. 🙇♂️ |
Thanks for your effort @alireza-ahmadi @superkhau Can we expect a new point release soon with this feature? |
@zbarbuto Can be released as soon as it lands. @kjdelisle will help you there once it passes CI -- I think it's hanging ATM now though. ;( |
@slnode test please |
LGTM |
Description
Loopback-datasource-juggler added support for
ILIKE
andNOT ILIKE
functionality in v3.1.0, but the PostgreSQL connector does not update to support them. This pull request adds this functionality by adding a few lines tolib/postgresql.js
file.Related issues
Please let me if any other changes needed.