Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 566cfa93
authored
Jan 25, 2020
by
Pedro Augusto de Paula Barbosa
Committed by
Sushant
Jan 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs(model): findOne return value for empty result (#11762)
1 parent
9512ab91
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
6 deletions
lib/model.js
types/lib/model.d.ts
lib/model.js
View file @
566cfa9
...
@@ -1893,9 +1893,7 @@ class Model {
...
@@ -1893,9 +1893,7 @@ class Model {
}
}
/**
/**
* Search for a single instance. This applies LIMIT 1, so the listener will always be called with a single instance.
* Search for a single instance. Returns the first instance found, or null if none can be found.
*
* __Alias__: _find_
*
*
* @param {object} [options] A hash of options to describe the scope of the search
* @param {object} [options] A hash of options to describe the scope of the search
* @param {Transaction} [options.transaction] Transaction to run query under
* @param {Transaction} [options.transaction] Transaction to run query under
...
@@ -1904,7 +1902,7 @@ class Model {
...
@@ -1904,7 +1902,7 @@ class Model {
* @see
* @see
* {@link Model.findAll} for an explanation of options
* {@link Model.findAll} for an explanation of options
*
*
* @returns {Promise<Model>}
* @returns {Promise<Model
|null
>}
*/
*/
static
findOne
(
options
)
{
static
findOne
(
options
)
{
if
(
options
!==
undefined
&&
!
_
.
isPlainObject
(
options
))
{
if
(
options
!==
undefined
&&
!
_
.
isPlainObject
(
options
))
{
...
...
types/lib/model.d.ts
View file @
566cfa9
...
@@ -1789,8 +1789,7 @@ export abstract class Model<T = any, T2 = any> extends Hooks {
...
@@ -1789,8 +1789,7 @@ export abstract class Model<T = any, T2 = any> extends Hooks {
):
Promise
<
M
|
null
>
;
):
Promise
<
M
|
null
>
;
/**
/**
* Search for a single instance. This applies LIMIT 1, so the listener will always be called with a single
* Search for a single instance. Returns the first instance found, or null if none can be found.
* instance.
*/
*/
public
static
findOne
<
M
extends
Model
>
(
this
:
{
new
():
M
}
&
typeof
Model
,
options
:
NonNullFindOptions
):
Promise
<
M
>
;
public
static
findOne
<
M
extends
Model
>
(
this
:
{
new
():
M
}
&
typeof
Model
,
options
:
NonNullFindOptions
):
Promise
<
M
>
;
public
static
findOne
<
M
extends
Model
>
(
public
static
findOne
<
M
extends
Model
>
(
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment