不要怂,就是干,撸起袖子干!

Commit 4fd6cbaa by Mick Hansen

Merge pull request #2010 from meetearnest/ilike

ILIKE support for postgres
2 parents 761317b9 a9bde2ce
Showing with 39 additions and 0 deletions
......@@ -318,6 +318,11 @@ var Utils = module.exports = {
case 'nlike':
case 'notlike':
return 'NOT LIKE';
case 'ilike':
return 'ILIKE';
case 'nilike':
case 'notilike':
return 'NOT ILIKE';
default:
return '';
}
......
......@@ -139,6 +139,40 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})
if (dialect === 'postgres') {
it('should be able to find a row using ilike', function(done) {
this.User.findAll({
where: {
username: {
ilike: '%2'
}
}
}).success(function(users) {
expect(users).to.be.an.instanceof(Array)
expect(users).to.have.length(1)
expect(users[0].username).to.equal('boo2')
expect(users[0].intVal).to.equal(10)
done()
})
})
it('should be able to find a row using not ilike', function(done) {
this.User.findAll({
where: {
username: {
notilike: '%2'
}
}
}).success(function(users) {
expect(users).to.be.an.instanceof(Array)
expect(users).to.have.length(1)
expect(users[0].username).to.equal('boo')
expect(users[0].intVal).to.equal(5)
done()
})
})
}
it('should be able to find a row between a certain date using the between shortcut', function(done) {
this.User.findAll({
where: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!