mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-18 12:08:59 +08:00
Allow to assign result of Sequelize.where() to where clause in find options. (#19962)
This commit is contained in:
committed by
Mohamed Hegazy
parent
a7c466fd5b
commit
e1a2d5cfc4
14
types/sequelize/index.d.ts
vendored
14
types/sequelize/index.d.ts
vendored
@@ -3202,21 +3202,21 @@ declare namespace sequelize {
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut for types used in FindOptions.attributes
|
||||
*/
|
||||
* Shortcut for types used in FindOptions.attributes
|
||||
*/
|
||||
type FindOptionsAttributesArray = Array<string | literal | [string, string] | fn | [fn, string] | cast | [cast, string] | [literal, string]>;
|
||||
|
||||
/**
|
||||
* Options that are passed to any model creating a SELECT query
|
||||
*
|
||||
* A hash of options to describe the scope of the search
|
||||
*/
|
||||
* Options that are passed to any model creating a SELECT query
|
||||
*
|
||||
* A hash of options to describe the scope of the search
|
||||
*/
|
||||
interface FindOptions<T> extends LoggingOptions, SearchPathOptions {
|
||||
|
||||
/**
|
||||
* A hash of attributes to describe your search. See above for examples.
|
||||
*/
|
||||
where?: WhereOptions<T> | fn | Array<col | and | or | string>;
|
||||
where?: WhereOptions<T> | where | fn | Array<col | and | or | string>;
|
||||
|
||||
/**
|
||||
* A list of the attributes that you want to select. To rename an attribute, you can pass an array, with
|
||||
|
||||
@@ -7,7 +7,7 @@ import Bluebird = require('bluebird');
|
||||
// ~~~~~~~~~~
|
||||
//
|
||||
|
||||
interface AnyAttributes { };
|
||||
interface AnyAttributes { [name: string]: boolean | number | string | object; };
|
||||
interface AnyInstance extends Sequelize.Instance<AnyAttributes> { };
|
||||
|
||||
var s = new Sequelize( '' );
|
||||
@@ -914,6 +914,7 @@ User.findAll( { attributes: [[s.fn('count', Sequelize.col('*')), 'count']], grou
|
||||
User.findAll( { attributes: [s.cast(s.fn('count', Sequelize.col('*')), 'INTEGER')] });
|
||||
User.findAll( { attributes: [[s.cast(s.fn('count', Sequelize.col('*')), 'INTEGER'), 'count']] });
|
||||
User.findAll( { where : s.fn('count', [0, 10]) } );
|
||||
User.findAll( { where: s.where(s.fn('lower', s.col('email')), s.fn('lower', 'TEST@SEQUELIZEJS.COM')) } );
|
||||
User.findAll( { subQuery: false, include : [User], order : [[User, User, 'numYears', 'c']] } );
|
||||
User.findAll( { rejectOnEmpty: true });
|
||||
|
||||
@@ -937,6 +938,7 @@ User.findOne( { where : { name : 'Boris' }, include : [User, { model : User, as
|
||||
User.findOne( { where : { username : 'someone' }, include : [User] } );
|
||||
User.findOne( { where : { username : 'barfooz' }, raw : true } );
|
||||
User.findOne( { where : s.fn('count', []) } );
|
||||
User.findOne( { where: s.where(s.fn('lower', s.col('email')), s.fn('lower', 'TEST@SEQUELIZEJS.COM')) } );
|
||||
/* NOTE https://github.com/DefinitelyTyped/DefinitelyTyped/pull/5590
|
||||
User.findOne( { updatedAt : { ne : null } } );
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user