sequelize/sequelize — pull request #2318 by janmeier (2014-09-21 20:20:05+00:00)
Title: [WIP] Made sequelize.where smarter

This PR was sparked by https://github.com/sequelize/sequelize/issues/2298 and adds support for syntax like this:

```js
return User.findAll({
where: Sequelize.and(
{ type: 1 },
Sequelize.where(Sequelize.fn('unnacent', Sequelize.col('user.name')), "%t%", 'ILIKE')
)
});
```
```sql
SELECT * from users WHERE unnacent(users.name) ILIKE '%t%' AND users.type = 1
```

Generally, sequelize.where can now take any sequelize condition object as the key. I've also refactored a bit how sequelize methods are handled in the query generator and moved handling into its own method. I've also moved the code for converting sequelize methods into SQL from utils to the query generator.