fix Sequelize.FindOptions to be able use functions as attributes and make grouping. (#9485)

This commit is contained in:
postpersonality
2016-06-02 23:39:01 +09:00
committed by Masahiro Wakame
parent 8daa4ef04a
commit 6d61dabe67
2 changed files with 12 additions and 2 deletions
+4
View File
@@ -888,6 +888,10 @@ User.findAll( { include : [User], order : [['id', 'ASC NULLS LAST'], [User, 'id'
User.findAll( { include : [{ model : User, where : { title : 'DoDat' }, include : [{ model : User }] }] } );
User.findAll( { attributes: ['username', 'data']});
User.findAll( { attributes: {include: ['username', 'data']} });
User.findAll( { attributes: [['username', 'UNM'], ['email', 'EML']] });
User.findAll( { attributes: [s.fn('count', Sequelize.col('*'))] });
User.findAll( { attributes: [[s.fn('count', Sequelize.col('*')), 'count']] });
User.findAll( { attributes: [[s.fn('count', Sequelize.col('*')), 'count']], group: ['sex'] });
User.findById( 'a string' );
+8 -2
View File
@@ -3133,7 +3133,7 @@ declare module "sequelize" {
* `Sequelize.literal`, `Sequelize.fn` and so on), and the second is the name you want the attribute to
* have in the returned instance
*/
attributes? : Array<string> | { include?: Array<string>, exclude?: Array<string> };
attributes?: Array<string | fn | [string, string] | [fn, string]> | { include?: Array<string>, exclude?: Array<string> };
/**
* If true, only non-deleted records will be returned. If false, both deleted and non-deleted records will
@@ -3194,6 +3194,12 @@ declare module "sequelize" {
*/
having? : WhereOptions;
/**
* Group by. It is not mentioned in sequelize's JSDoc, but mentioned in docs.
* https://github.com/sequelize/sequelize/blob/master/docs/docs/models-usage.md#user-content-manipulating-the-dataset-with-limit-offset-order-and-group
*/
group?: string | string[] | Object;
}
/**
@@ -6186,4 +6192,4 @@ declare module "sequelize" {
export = sequelize;
}
}