不要怂,就是干,撸起袖子干!

Commit 566cfa93 by Pedro Augusto de Paula Barbosa Committed by Sushant

docs(model): findOne return value for empty result (#11762)

1 parent 9512ab91
Showing with 3 additions and 6 deletions
...@@ -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)) {
......
...@@ -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>(
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!