Merge pull request #30380 from weagle08/master

Sequelize - added findByPk to Model def
This commit is contained in:
Benjamin Lichtman
2018-11-20 09:39:13 -08:00
committed by GitHub
2 changed files with 5 additions and 0 deletions
+1
View File
@@ -3908,6 +3908,7 @@ declare namespace sequelize {
*/
findById<TCustomAttributes>(identifier?: number | string | Buffer, options?: FindOptions<TAttributes & TCustomAttributes>): Promise<TInstance | null>;
findByPrimary<TCustomAttributes>(identifier?: number | string | Buffer, options?: FindOptions<TAttributes & TCustomAttributes>): Promise<TInstance | null>;
findByPk<TCustomAttributes>(identifier?: number | string | Buffer, options?: FindOptions<TAttributes & TCustomAttributes>): Promise<TInstance | null>;
/**
* Search for a single instance. This applies LIMIT 1, so the listener will always be called with a single
+4
View File
@@ -981,6 +981,10 @@ User.findByPrimary( 'a string' );
User.findByPrimary( 42 );
User.findByPrimary( Buffer.from('a buffer') );
User.findByPk( 'a string' );
User.findByPk( 42 );
User.findByPk( Buffer.from('a buffer') );
User.findOne( { where : { username : 'foo' } } );
User.findOne( { where : { id : 1 }, attributes : ['id', ['username', 'name']] } );
User.findOne( { where : { id : 1 }, attributes : ['id'] } );