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

Commit a9bde2ce by Ryan Pon

feat: add ilike support for postgres

1 parent 11347233
Showing with 39 additions and 0 deletions
...@@ -315,6 +315,11 @@ var Utils = module.exports = { ...@@ -315,6 +315,11 @@ var Utils = module.exports = {
case 'nlike': case 'nlike':
case 'notlike': case 'notlike':
return 'NOT LIKE'; return 'NOT LIKE';
case 'ilike':
return 'ILIKE';
case 'nilike':
case 'notilike':
return 'NOT ILIKE';
default: default:
return ''; return '';
} }
......
...@@ -139,6 +139,40 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () { ...@@ -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) { it('should be able to find a row between a certain date using the between shortcut', function(done) {
this.User.findAll({ this.User.findAll({
where: { where: {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!