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

Commit bd6fa212 by Sushant

docs: links cleanup, fixes #8902

1 parent a6ac276b
Showing with 34 additions and 13 deletions
......@@ -1209,8 +1209,11 @@ class Model {
}
/**
* Sync this Model to the DB, that is create the table. Upon success, the callback will be called with the model instance (this)
* Sync this Model to the DB, that is create the table.
* Upon success, the callback will be called with the model instance (this)
*
* @see {@link Sequelize#sync} for options
*
* @return {Promise<this>}
*/
static sync(options) {
......@@ -1316,10 +1319,12 @@ class Model {
/**
* Drop the table represented by this Model
*
* @param {Object} [options]
* @param {Boolean} [options.cascade=false] Also drop all objects depending on this table, such as views. Only works in postgres
* @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql.
* @param {Boolean} [options.benchmark=false] Pass query execution time in milliseconds as second argument to logging function (options.logging).
*
* @return {Promise}
*/
static drop(options) {
......@@ -1459,6 +1464,7 @@ class Model {
* ```
*
* @param {Array|Object|String|null} options The scope(s) to apply. Scopes can either be passed as consecutive arguments, or as an array of arguments. To apply simple scopes and scope functions with no arguments, pass them as strings. For scope function, pass an object, with a `method` property. The value can either be a string, if the method does not take any arguments, or an array, where the first element is the name of the method, and consecutive elements are arguments to that method. Pass null to remove all scopes, including the default.
*
* @return {Model} A reference to the model, with the scope(s) applied. Calling scope again on the returned model will clear the previous scope.
*/
static scope(option) {
......@@ -1632,7 +1638,8 @@ class Model {
* @param {String} [options.searchPath=DEFAULT] An optional parameter to specify the schema search_path (Postgres only)
* @param {Boolean|Error} [options.rejectOnEmpty=false] Throws an error when no records found
*
* @link {@link Sequelize.query}
* @see {@link Sequelize#query}
*
* @return {Promise<Array<Model>>}
*/
static findAll(options) {
......@@ -1999,6 +2006,8 @@ class Model {
* @param {Object} [findOptions] See findAll
*
* @see {@link Model.findAll} for a specification of find and query options
* @see {@link Model.count} for a specification of count options
*
* @return {Promise<{count: Integer, rows: Model[]}>}
*/
static findAndCount(options) {
......@@ -2026,7 +2035,7 @@ class Model {
*
* @param {String} field
* @param {Object} [options] See aggregate
* @see {@link Model#aggregate} for options
* @see {@link Model.aggregate} for options
*
* @return {Promise<Any>}
*/
......@@ -2039,7 +2048,7 @@ class Model {
*
* @param {String} field
* @param {Object} [options] See aggregate
* @see {@link Model#aggregate} for options
* @see {@link Model.aggregate} for options
*
* @return {Promise<Any>}
*/
......@@ -2052,7 +2061,7 @@ class Model {
*
* @param {String} field
* @param {Object} [options] See aggregate
* @see {@link Model#aggregate} for options
* @see {@link Model.aggregate} for options
*
* @return {Promise<Number>}
*/
......@@ -2069,7 +2078,7 @@ class Model {
* @param {Boolean} [options.isNewRecord=true]
* @param {Array} [options.include] an array of include options - Used to build prefetched/included model instances. See `set`
*
* @return {(Model|Model[])}
* @return {Model|Array<Model>}
*/
static build(values, options) { // testhint options:none
if (Array.isArray(values)) {
......@@ -2102,8 +2111,8 @@ class Model {
/**
* Builds a new model instance and calls save on it.
* @see {@link Model#build}
* @see {@link Model#save}
* @see {@link Model.build}
* @see {@link Model.save}
*
* @param {Object} values
* @param {Object} [options]
......@@ -2185,11 +2194,13 @@ class Model {
* However, it is not always possible to handle this case in SQLite, specifically if one transaction inserts and another tries to select before the first one has committed. In this case, an instance of sequelize. TimeoutError will be thrown instead.
* If a transaction is created, a savepoint will be created instead, and any unique constraint violation will be handled internally.
*
* @see {@link Model.findAll} for a full specification of find and options
*
* @param {Object} options
* @param {Object} options.where where A hash of search attributes.
* @param {Object} [options.defaults] Default values to use if creating a new instance
* @param {Transaction} [options.transaction] Transaction to run query under
* @see {@link Model.findAll} for a full specification of find and options
*
* @return {Promise<Model,created>}
*/
static findOrCreate(options) {
......@@ -2292,10 +2303,12 @@ class Model {
* A more performant findOrCreate that will not work under a transaction (at least not in postgres)
* Will execute a find call, if empty then attempt to create, if unique constraint then attempt to find again
*
* @see {@link Model.findAll} for a full specification of find and options
*
* @param {Object} options
* @param {Object} options.where where A hash of search attributes.
* @param {Object} options.where A hash of search attributes.
* @param {Object} [options.defaults] Default values to use if creating a new instance
* @see {@link Model.findAll} for a full specification of find and options
*
* @return {Promise<Model,created>}
*/
static findCreateFind(options) {
......@@ -2600,7 +2613,7 @@ class Model {
*
* @return {Promise}
*
* @see {@link Model#destroy} for more information
* @see {@link Model.destroy} for more information
*/
static truncate(options) {
options = Utils.cloneDeep(options) || {};
......@@ -2623,6 +2636,7 @@ class Model {
* @param {Transaction} [options.transaction] Transaction to run query under
* @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql.
* @param {Boolean} [options.benchmark=false] Pass query execution time in milliseconds as second argument to logging function (options.logging).
*
* @return {Promise<Integer>} The number of destroyed rows
*/
static destroy(options) {
......@@ -3153,7 +3167,7 @@ class Model {
* Model.decrement({ answer: 42, tries: -1}, { by: 2, where: { foo: 'bar' } });
* ```
*
* @see {@link Model#increment}
* @see {@link Model.increment}
* @see {@link Model#reload}
* @since 4.36.0
......@@ -3233,6 +3247,7 @@ class Model {
* @param {Object} [options]
* @param {Boolean} [options.plain=false] If set to true, included instances will be returned as plain objects
* @param {Boolean} [options.raw=false] If set to true, field and virtual setters will be ignored
*
* @return {Object|any}
*/
get(key, options) { // testhint options:none
......@@ -3298,11 +3313,14 @@ class Model {
* If called with a dot.separated key on a JSON/JSONB attribute it will set the value nested and flag the entire object as changed.
*
* @see {@link Model.findAll} for more information about includes
*
* @param {String|Object} key
* @param {any} value
* @param {Object} [options]
* @param {Boolean} [options.raw=false] If set to true, field and virtual setters will be ignored
* @param {Boolean} [options.reset=false] Clear all previously set data values
*
* @return this
*/
set(key, value, options) { // testhint options:none
let values;
......@@ -3529,6 +3547,7 @@ class Model {
* @param {Transaction} [options.transaction]
* @param {String} [options.searchPath=DEFAULT] An optional parameter to specify the schema search_path (Postgres only)
* @param {Boolean} [options.returning] Append RETURNING * to get back auto generated values (Postgres only)
*
* @return {Promise<this|Errors.ValidationError>}
*/
save(options) {
......@@ -3789,6 +3808,7 @@ class Model {
* all references to the Instance are updated with the new data and no new objects are created.
*
* @see {@link Model.findAll}
*
* @param {Object} [options] Options that are passed on to `Model.find`
* @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql.
*
......@@ -3842,6 +3862,7 @@ class Model {
*
* @see {@link Model#set}
* @see {@link Model#save}
*
* @param {Object} updates See `set`
* @param {Object} options See `save`
*
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!