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

Adding NOT ILIKE for postgres #2195

Merged
merged 1 commit into from Aug 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/formatter.js
Expand Up @@ -9,7 +9,7 @@ const orderBys = ['asc', 'desc'];
// Turn this into a lookup map
const operators = transform([
'=', '<', '>', '<=', '>=', '<>', '!=', 'like',
'not like', 'between', 'ilike', '&', '|', '^', '<<', '>>',
'not like', 'between', 'ilike', 'not ilike', '&', '|', '^', '<<', '>>',
'rlike', 'regexp', 'not regexp', '~', '~*', '!~', '!~*',
'#', '&&', '@>', '<@', '||'
], (result, key) => {
Expand Down
9 changes: 9 additions & 0 deletions test/unit/query/builder.js
Expand Up @@ -3358,6 +3358,15 @@ describe("QueryBuilder", function() {
});
});

it('supports NOT ILIKE operator in Postgres', function() {
testsql(qb().select('*').from('users').where('name', 'not ilike', '%jeff%'), {
postgres: {
sql: 'select * from "users" where "name" not ilike ?',
bindings: ['%jeff%']
}
});
});

it('throws if you try to use an invalid operator', function() {
expect(function () {
qb().select('*').where('id', 'isnt', 1).toString();
Expand Down