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

Commit f48758d6 by Jan Aagaard Meier

Getting closer!

1 parent 4db5a5dd
......@@ -36,6 +36,8 @@ const HasOne = require('./has-one');
*
* @class BelongsToMany
* @memberof Associations
*
* @see {@link Model.belongsToMany}
*/
class BelongsToMany extends Association {
constructor(source, target, options) {
......@@ -204,7 +206,7 @@ class BelongsToMany extends Association {
* @param {Object} [options.where] An optional where clause to limit the associated models
* @param {String|Boolean} [options.scope] Apply a scope on the related model, or remove its default scope by passing false
* @param {String} [options.schema] Apply a schema on the related model
* @see {Model#findAll} for a full explanation of options
* @see {@link Model#findAll} for a full explanation of options
* @return {Promise<Array<Model>>}
* @method getAssociations
* @memberof Associations.BelongsToMany
......
......@@ -13,6 +13,8 @@ const Association = require('./base');
*
* @class BelongsTo
* @memberof Associations
*
* @see {@link Model.belongsTo}
*/
class BelongsTo extends Association {
constructor(source, target, options) {
......@@ -101,7 +103,7 @@ class BelongsTo extends Association {
*
* @param {Object} [values]
* @param {Object} [options] Options passed to `target.create` and setAssociation.
* @see {Model#create} for a full explanation of options
* @see {@link Model#create} for a full explanation of options
* @return {Promise}
* @method createAssociation
* @memberof Associations.BelongsTo
......
......@@ -12,6 +12,8 @@ const Association = require('./base');
*
* @class HasMany
* @memberof Associations
*
* @see {@link Model.hasMany}
*/
class HasMany extends Association {
constructor(source, target, options) {
......@@ -98,7 +100,7 @@ class HasMany extends Association {
* @param {Object} [options.where] An optional where clause to limit the associated models
* @param {String|Boolean} [options.scope] Apply a scope on the related model, or remove its default scope by passing false
* @param {String} [options.schema] Apply a schema on the related model
* @see {Model#findAll} for a full explanation of options
* @see {@link Model#findAll} for a full explanation of options
* @return {Promise<Array<Model>>}
* @method getAssociations
* @memberof Associations.HasMany
......@@ -344,8 +346,7 @@ class HasMany extends Association {
options = Utils.cloneDeep(options);
options.attributes = [
[sequelize.fn('COUNT', sequelize.col([model.name, model.primaryKeyAttribute].join('.'))), 'count']
[sequelize.fn('COUNT', sequelize.col(model.primaryKeyField)), 'count']
];
options.raw = true;
options.plain = true;
......
......@@ -13,6 +13,8 @@ const Association = require('./base');
*
* @class HasOne
* @memberof Associations
*
* @see {@link Model.hasOne}
*/
class HasOne extends Association {
constructor(srcModel, targetModel, options) {
......@@ -76,7 +78,7 @@ class HasOne extends Association {
* @param {Object} [options]
* @param {String|Boolean} [options.scope] Apply a scope on the related model, or remove its default scope by passing false
* @param {String} [options.schema] Apply a schema on the related model
* @see {Model#findOne} for a full explanation of options
* @see {@link Model#findOne} for a full explanation of options
* @return {Promise<Model>}
* @method getAssociation
* @memberof Associations.HasOne
......@@ -85,7 +87,7 @@ class HasOne extends Association {
/**
* Set the associated model.
*
* @param {Instance|String|Number} [newAssociation] An persisted instance or the primary key of a persisted instance to associate with this. Pass `null` or `undefined` to remove the association.
* @param {Model|String|Number} [newAssociation] An persisted instance or the primary key of a persisted instance to associate with this. Pass `null` or `undefined` to remove the association.
* @param {Object} [options] Options passed to getAssociation and `target.save`
* @return {Promise}
* @method setAssociation
......@@ -97,7 +99,7 @@ class HasOne extends Association {
*
* @param {Object} [values]
* @param {Object} [options] Options passed to `target.create` and setAssociation.
* @see {Model#create} for a full explanation of options
* @see {@link Model#create} for a full explanation of options
* @return {Promise}
* @method createAssociation
* @memberof Associations.HasOne
......
......@@ -40,6 +40,8 @@ var util = require('util');
* @property INITIALLY_DEFERRED Defer constraints checks to the end of transactions.
* @property INITIALLY_IMMEDIATE Trigger the constraint checks immediately
* @property NOT Set the constraints to not deferred. This is the default in PostgreSQL and it make it impossible to dynamically defer the constraints within a transaction.
* @property SET_DEFERRED
* @property SET_IMMEDIATE
*/
var Deferrable = module.exports = {
INITIALLY_DEFERRED,
......@@ -55,12 +57,6 @@ ABSTRACT.prototype.toString = function() {
return this.toSql.apply(this, arguments);
};
/**
* A property that will defer constraints checks to the end of transactions.
*
* @memberOf Sequelize.Deferrable
*/
function INITIALLY_DEFERRED() {
if (!(this instanceof INITIALLY_DEFERRED)) {
return new INITIALLY_DEFERRED();
......@@ -72,11 +68,6 @@ INITIALLY_DEFERRED.prototype.toSql = function() {
return 'DEFERRABLE INITIALLY DEFERRED';
};
/**
* A property that will trigger the constraint checks immediately
*
* @memberOf Sequelize.Deferrable
*/
function INITIALLY_IMMEDIATE() {
if (!(this instanceof INITIALLY_IMMEDIATE)) {
return new INITIALLY_IMMEDIATE();
......@@ -88,13 +79,6 @@ INITIALLY_IMMEDIATE.prototype.toSql = function() {
return 'DEFERRABLE INITIALLY IMMEDIATE';
};
/**
* A property that will set the constraints to not deferred. This is
* the default in PostgreSQL and it make it impossible to dynamically
* defer the constraints within a transaction.
*
* @memberOf Sequelize.Deferrable
*/
function NOT() {
if (!(this instanceof NOT)) {
return new NOT();
......@@ -106,14 +90,6 @@ NOT.prototype.toSql = function() {
return 'NOT DEFERRABLE';
};
/**
* A property that will trigger an additional query at the beginning of a
* transaction which sets the constraints to deferred.
*
* @param {Array} constraints An array of constraint names. Will defer all constraints by default.
* @memberof Sequelize.Deferrable
*/
function SET_DEFERRED(constraints) {
if (!(this instanceof SET_DEFERRED)) {
return new SET_DEFERRED(constraints);
......@@ -127,14 +103,6 @@ SET_DEFERRED.prototype.toSql = function(queryGenerator) {
return queryGenerator.setDeferredQuery(this.constraints);
};
/**
* A property that will trigger an additional query at the beginning of a
* transaction which sets the constraints to immediately.
*
* @param {Array} constraints An array of constraint names. Will defer all constraints by default.
* @memberof Sequelize.Deferrable
*/
function SET_IMMEDIATE(constraints) {
if (!(this instanceof SET_IMMEDIATE)) {
return new SET_IMMEDIATE(constraints);
......
......@@ -17,6 +17,7 @@ const parserMap = new Map();
*
* @extends AbstractConnectionManager
* @return Class<ConnectionManager>
* @private
*/
class ConnectionManager extends AbstractConnectionManager {
......@@ -65,6 +66,7 @@ class ConnectionManager extends AbstractConnectionManager {
* Also set proper timezone once conection is connected
*
* @return Promise<Connection>
* @private
*/
connect(config) {
const connectionConfig = {
......
......@@ -4,7 +4,8 @@
* Sequelize provides a host of custom error classes, to allow you to do easier debugging. All of these errors are exposed on the sequelize object and the sequelize constructor.
* All sequelize errors inherit from the base JS error object.
*
* @fileOverview The Error Objects produced by Sequelize.
* This means that errors can be accessed using `Sequelize.ValidationError` or `sequelize.ValidationError
*
* @namespace Errors
*/
......@@ -127,6 +128,9 @@ exports.TimeoutError = TimeoutError;
* Thrown when a unique constraint is violated in the database
* @extends DatabaseError
* @memberof Errors
*
* @property
* @property sql
*/
class UniqueConstraintError extends ValidationError {
constructor(options) {
......@@ -214,15 +218,13 @@ exports.ValidationErrorItem = ValidationErrorItem;
* A base class for all connection related errors.
* @extends BaseError
* @memberof Errors
*
* @property parent The connection specific error which triggered this one
*/
class ConnectionError extends BaseError {
constructor(parent) {
super(parent ? parent.message : '');
this.name = 'SequelizeConnectionError';
/**
* The connection specific error which triggered this one
* @member parent
*/
this.parent = parent;
this.original = parent;
}
......@@ -246,7 +248,6 @@ exports.ConnectionRefusedError = ConnectionRefusedError;
* Thrown when a connection to a database is refused due to insufficient privileges
* @extends ConnectionError
* @memberof Errors
* @memberof Sequelize
*/
class AccessDeniedError extends ConnectionError {
constructor(parent) {
......
......@@ -4,39 +4,6 @@ const Utils = require('./utils');
const Promise = require('./promise');
const debug = Utils.getLogger().debugContext('hooks');
/**
* Hooks are function that are called before and after (bulk-) creation/updating/deletion and validation. Hooks can be added to you models in three ways:
*
* 1. By specifying them as options in `sequelize.define`
* 2. By calling `hook()` with a string and your hook handler function
* 3. By calling the function with the same name as the hook you want
*
* ```js
* // Method 1
* sequelize.define(name, { attributes }, {
* hooks: {
* beforeBulkCreate() {
* // can be a single function
* },
* beforeValidate: [
* function() {},
* function() {} // Or an array of several
* ]
* }
* })
*
* // Method 2
* Model.hook('afterDestroy', function () {})
*
* // Method 3
* Model.afterBulkUpdate(function () {})
* ```
*
* @see {Sequelize#define}
* @mixin Hooks
* @name Hooks
*/
const hookTypes = {
beforeValidate: {params: 2},
afterValidate: {params: 2},
......@@ -162,11 +129,12 @@ const Hooks = {
/**
* Add a hook to the model
*
* @param {String} hooktype
* @param {String} hookType
* @param {String} [name] Provide a name for the hook function. It can be used to remove the hook later or to order hooks based on some sort of priority system in the future.
* @param {Function} fn The hook function
*
* @alias hook
* @memberOf Sequelize
* @memberOf Sequelize.Model
*/
addHook(hookType, name, fn) {
if (typeof name === 'function') {
......@@ -193,6 +161,9 @@ const Hooks = {
*
* @param {String} hookType
* @param {String|Function} name
*
* @memberOf Sequelize
* @memberOf Sequelize.Model
*/
removeHook(hookType, name) {
hookType = hookAliases[hookType] || hookType;
......@@ -226,6 +197,8 @@ const Hooks = {
* @param {String} hookType
*
* @alias hasHooks
* @memberOf Sequelize
* @memberOf Sequelize.Model
*/
hasHook(hookType) {
return this.options.hooks[hookType] && !!this.options.hooks[hookType].length;
......@@ -251,6 +224,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with instance, options
* @name beforeValidate
* @memberOf Sequelize.Model
*/
/**
......@@ -258,6 +232,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with instance, options
* @name afterValidate
* @memberOf Sequelize.Model
*/
/**
......@@ -266,6 +241,7 @@ exports.applyTo = applyTo;
* @param {Function} fn A callback function that is called with instance, options, error. Error is the
* SequelizeValidationError. If the callback throws an error, it will replace the original validation error.
* @name validationFailed
* @memberOf Sequelize.Model
*/
/**
......@@ -273,6 +249,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with attributes, options
* @name beforeCreate
* @memberOf Sequelize.Model
*/
/**
......@@ -280,6 +257,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with attributes, options
* @name afterCreate
* @memberOf Sequelize.Model
*/
/**
......@@ -287,6 +265,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with attributes, options
* @name beforeSave
* @memberOf Sequelize.Model
*/
/**
......@@ -294,6 +273,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with attributes, options
* @name beforeUpsert
* @memberOf Sequelize.Model
*/
/**
......@@ -301,6 +281,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with attributes, options
* @name afterUpsert
* @memberOf Sequelize.Model
*/
/**
......@@ -308,6 +289,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with attributes, options
* @name afterSave
* @memberOf Sequelize.Model
*/
/**
......@@ -317,6 +299,7 @@ exports.applyTo = applyTo;
*
* @name beforeDestroy
* @alias beforeDelete
* @memberOf Sequelize.Model
*/
/**
......@@ -326,6 +309,7 @@ exports.applyTo = applyTo;
*
* @name afterDestroy
* @alias afterDelete
* @memberOf Sequelize.Model
*/
/**
......@@ -334,6 +318,7 @@ exports.applyTo = applyTo;
* @param {Function} fn A callback function that is called with instance, options
*
* @name beforeRestore
* @memberOf Sequelize.Model
*/
/**
......@@ -342,6 +327,7 @@ exports.applyTo = applyTo;
* @param {Function} fn A callback function that is called with instance, options
*
* @name afterRestore
* @memberOf Sequelize.Model
*/
/**
......@@ -349,6 +335,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with instance, options
* @name beforeUpdate
* @memberOf Sequelize.Model
*/
/**
......@@ -356,6 +343,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with instance, options
* @name afterUpdate
* @memberOf Sequelize.Model
*/
/**
......@@ -363,6 +351,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with instances, options
* @name beforeBulkCreate
* @memberOf Sequelize.Model
*/
/**
......@@ -370,6 +359,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with instances, options
* @name afterBulkCreate
* @memberOf Sequelize.Model
*/
/**
......@@ -379,6 +369,7 @@ exports.applyTo = applyTo;
*
* @name beforeBulkDestroy
* @alias beforeBulkDelete
* @memberOf Sequelize.Model
*/
/**
......@@ -388,6 +379,7 @@ exports.applyTo = applyTo;
*
* @name afterBulkDestroy
* @alias afterBulkDelete
* @memberOf Sequelize.Model
*/
/**
......@@ -396,6 +388,7 @@ exports.applyTo = applyTo;
* @param {Function} fn A callback function that is called with options
*
* @name beforeBulkRestore
* @memberOf Sequelize.Model
*/
/**
......@@ -404,6 +397,7 @@ exports.applyTo = applyTo;
* @param {Function} fn A callback function that is called with options
*
* @name afterBulkRestore
* @memberOf Sequelize.Model
*/
/**
......@@ -411,6 +405,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with options
* @name beforeBulkUpdate
* @memberOf Sequelize.Model
*/
/**
......@@ -418,6 +413,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with options
* @name afterBulkUpdate
* @memberOf Sequelize.Model
*/
/**
......@@ -425,6 +421,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with options
* @name beforeFind
* @memberOf Sequelize.Model
*/
/**
......@@ -432,6 +429,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with options
* @name beforeFindAfterExpandIncludeAll
* @memberOf Sequelize.Model
*/
/**
......@@ -439,6 +437,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with options
* @name beforeFindAfterOptions
* @memberOf Sequelize.Model
*/
/**
......@@ -446,6 +445,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with instance(s), options
* @name afterFind
* @memberOf Sequelize.Model
*/
/**
......@@ -453,6 +453,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with options
* @name beforeCount
* @memberOf Sequelize.Model
*/
/**
......@@ -460,6 +461,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with attributes, options
* @name beforeDefine
* @memberOf Sequelize
*/
/**
......@@ -467,6 +469,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with factory
* @name afterDefine
* @memberOf Sequelize
*/
/**
......@@ -474,6 +477,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with config, options
* @name beforeInit
* @memberOf Sequelize
*/
/**
......@@ -481,6 +485,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with sequelize
* @name afterInit
* @memberOf Sequelize
*/
/**
......@@ -488,6 +493,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with config passed to connection
* @name beforeConnect
* @memberOf Sequelize
*/
/**
......@@ -495,6 +501,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with options passed to Model.sync
* @name beforeSync
* @memberOf Sequelize
*/
/**
......@@ -502,6 +509,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with options passed to Model.sync
* @name afterSync
* @memberOf Sequelize
*/
/**
......@@ -509,6 +517,7 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with options passed to sequelize.sync
* @name beforeBulkSync
* @memberOf Sequelize
*/
/**
......@@ -516,4 +525,5 @@ exports.applyTo = applyTo;
* @param {String} name
* @param {Function} fn A callback function that is called with options passed to sequelize.sync
* @name afterBulkSync
* @memberOf Sequelize
*/
......@@ -607,21 +607,16 @@ class Model {
*
* As shown above, column definitions can be either strings, a reference to one of the datatypes that are predefined on the Sequelize constructor, or an object that allows you to specify both the type of the column, and other attributes such as default values, foreign key constraints and custom setters and getters.
*
* For a list of possible data types, see http://docs.sequelizejs.com/en/latest/docs/models-definition/#data-types
*
* For more about getters and setters, see http://docs.sequelizejs.com/en/latest/docs/models-definition/#getters-setters
*
* For more about instance and class methods, see http://docs.sequelizejs.com/en/latest/docs/models-definition/#expansion-of-models
* For a list of possible data types, see {@link DataTypes}
*
* For more about validation, see http://docs.sequelizejs.com/en/latest/docs/models-definition/#validations
*
* @see {@link DataTypes}
* @see {@link Hooks}
*
* @param {String} modelName The name of the model. The model will be stored in `sequelize.models` under this name
* @param {Object} attributes An object, where each attribute is a column of the table. Each column can be either a DataType, a string or a type-description object, with the properties described below:
* @param {String|DataType|Object} attributes.column The description of a database column
* @param {String|DataType} attributes.column.type A string or a data type
* @param {String|DataTypes|Object} attributes.column The description of a database column
* @param {String|DataTypes} attributes.column.type A string or a data type
* @param {Boolean} [attributes.column.allowNull=true] If false, the column will have a NOT NULL constraint, and a not null validation will be run before an instance is saved.
* @param {any} [attributes.column.defaultValue=null] A literal default value, a JavaScript function, or an SQL function (see `sequelize.fn`)
* @param {String|Boolean} [attributes.column.unique=false] If true, the column will get a unique constraint. If a string is provided, the column will be part of a composite unique index. If multiple columns have the same string, they will be part of the same unique index
......@@ -660,8 +655,6 @@ class Model {
* @param {String|Boolean} [options.updatedAt] Override the name of the updatedAt column if a string is provided, or disable it if false. Timestamps must be true. Not affected by underscored setting.
* @param {String|Boolean} [options.deletedAt] Override the name of the deletedAt column if a string is provided, or disable it if false. Timestamps must be true. Not affected by underscored setting.
* @param {String} [options.tableName] Defaults to pluralized model name, unless freezeTableName is true, in which case it uses model name verbatim
* @param {Object} [options.getterMethods] Provide getter functions that work like those defined per column. If you provide a getter method with the same name as a column, it will be used to access the value of that column. If you provide a name that does not match a column, this function will act as a virtual getter, that can fetch multiple other values
* @param {Object} [options.setterMethods] Provide setter functions that work like those defined per column. If you provide a setter method with the same name as a column, it will be used to update the value of that column. If you provide a name that does not match a column, this function will act as a virtual setter, that can act on and set other values, but will not be persisted
* @param {String} [options.schema='public']
* @param {String} [options.engine]
* @param {String} [options.charset]
......@@ -2991,7 +2984,7 @@ 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#find} for more information about includes
* @see {@link Model#findAll} for more information about includes
* @param {String|Object} key
* @param {any} value
* @param {Object} [options]
......@@ -3463,7 +3456,7 @@ class Model {
* This is different from doing a `find(Instance.id)`, because that would create and return a new instance. With this method,
* all references to the Instance are updated with the new data and no new objects are created.
*
* @see {@link Model#find}
* @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.
*
......
'use strict';
/**
* @namespace QueryTypes
* @memberof Sequelize
*
*
* @property SELECT
* @property INSERT
* @property UPDATE
* @property BULKUPDATE
* @property BULKDELETE
* @property DELETE
* @property UPSERT
* @property VERSION
* @property SHOWTABLES
* @property SHOWINDEXES
* @property DESCRIBE
* @property RAW
* @property FOREIGNKEYS
*/
module.exports = {
SELECT: 'SELECT',
INSERT: 'INSERT',
......
......@@ -28,7 +28,6 @@ const _ = require('lodash');
* In addition to sequelize, the connection library for the dialect you want to use should also be installed in your project. You don't need to import it however, as sequelize will take care of that.
*
* @class Sequelize
* @lands Errors
*/
/**
......@@ -286,6 +285,7 @@ class Sequelize {
* Returns an instance of QueryInterface.
* @method getQueryInterface
* @memberOf Sequelize
* @return {QueryInterface} An instance (singleton) of QueryInterface.
*/
getQueryInterface() {
......@@ -331,8 +331,8 @@ class Sequelize {
*
* For more about validation, see http://docs.sequelizejs.com/en/latest/docs/models-definition/#validations
*
* @see {DataTypes}
* @see {Hooks}
* @see {@link DataTypes}
* @param {String} modelName The name of the model. The model will be stored in `sequelize.models` under this name
* @param {String} modelName The name of the model. The model will be stored in `sequelize.models` under this name
* @param {Object} attributes An object, where each attribute is a column of the table. See Model.init()
* @param {Object} [options] These options are merged with the default define options provided to the Sequelize constructor and passed to Model.init()
......@@ -802,7 +802,6 @@ class Sequelize {
* })
* ```
*
* @see {@link Model#find}
* @see {@link Model#findAll}
* @see {@link Model#define}
* @see {@link Sequelize#col}
......@@ -863,7 +862,7 @@ class Sequelize {
/**
* An AND query
* @see {@link Model#find}
* @see {@link Model#findAll}
*
* @method and
* @param {String|Object} args Each argument will be joined by AND
......@@ -877,7 +876,7 @@ class Sequelize {
/**
* An OR query
* @see {@link Model#find}
* @see {@link Model#findAll}
*
* @method or
* @param {String|Object} args Each argument will be joined by OR
......@@ -891,7 +890,7 @@ class Sequelize {
/**
* Creates an object representing nested where conditions for postgres's json data-type.
* @see {@link Model#find}
* @see {@link Model#findAll}
*
* @method json
* @param {String|Object} conditions A hash containing strings/numbers or other nested hash, a string using dot notation or a string using postgres json syntax.
......@@ -911,7 +910,7 @@ class Sequelize {
*
* For string attributes, use the regular `{ where: { attr: something }}` syntax. If you don't want your string to be escaped, use `sequelize.literal`.
*
* @see {@link Model#find}
* @see {@link Model#findAll}
*
* @param {Object} attr The attribute, which can be either an attribute object from `Model.rawAttributes` or a sequelize object, for example an instance of `sequelize.fn`. For simple string attributes, use the POJO syntax
* @param {string} [comparator='=']
......@@ -1141,6 +1140,7 @@ Sequelize.prototype.Promise = Sequelize.Promise = Promise;
/**
* Available query types for use with `sequelize.query`
* @see {@link Sequelize.QueryTypes}
*/
Sequelize.prototype.QueryTypes = Sequelize.QueryTypes = QueryTypes;
......@@ -1190,122 +1190,54 @@ Sequelize.useInflection = Utils.useInflection;
Hooks.applyTo(Sequelize);
Hooks.applyTo(Sequelize.prototype);
/**
* A general error class
* @see {Errors#BaseError}
*/
Sequelize.prototype.Error = Sequelize.Error =
sequelizeErrors.BaseError;
/**
* Emitted when a validation fails
* @see {Errors#ValidationError}
*/
Sequelize.prototype.ValidationError = Sequelize.ValidationError =
sequelizeErrors.ValidationError;
/**
* Describes a validation error on an instance path
* @see {Errors#ValidationErrorItem}
*/
Sequelize.prototype.ValidationErrorItem = Sequelize.ValidationErrorItem =
sequelizeErrors.ValidationErrorItem;
/**
* A base class for all database related errors.
* @see {Errors#DatabaseError}
*/
Sequelize.prototype.DatabaseError = Sequelize.DatabaseError =
sequelizeErrors.DatabaseError;
/**
* Thrown when a database query times out because of a deadlock
* @see {Errors#TimeoutError}
*/
Sequelize.prototype.TimeoutError = Sequelize.TimeoutError =
sequelizeErrors.TimeoutError;
/**
* Thrown when a unique constraint is violated in the database
* @see {Errors#UniqueConstraintError}
*/
Sequelize.prototype.UniqueConstraintError = Sequelize.UniqueConstraintError =
sequelizeErrors.UniqueConstraintError;
/**
* Thrown when an exclusion constraint is violated in the database
* @see {Errors#ExclusionConstraintError}
*/
Sequelize.prototype.ExclusionConstraintError = Sequelize.ExclusionConstraintError =
sequelizeErrors.ExclusionConstraintError;
/**
* Thrown when a foreign key constraint is violated in the database
* @see {Errors#ForeignKeyConstraintError}
*/
Sequelize.prototype.ForeignKeyConstraintError = Sequelize.ForeignKeyConstraintError =
sequelizeErrors.ForeignKeyConstraintError;
/**
* A base class for all connection related errors.
* @see {Errors#ConnectionError}
*/
Sequelize.prototype.ConnectionError = Sequelize.ConnectionError =
sequelizeErrors.ConnectionError;
/**
* Thrown when a connection to a database is refused
* @see {Errors#ConnectionRefusedError}
*/
Sequelize.prototype.ConnectionRefusedError = Sequelize.ConnectionRefusedError =
sequelizeErrors.ConnectionRefusedError;
/**
* Thrown when a connection to a database is refused due to insufficient access
* @see {Errors#AccessDeniedError}
*/
Sequelize.prototype.AccessDeniedError = Sequelize.AccessDeniedError =
sequelizeErrors.AccessDeniedError;
/**
* Thrown when a connection to a database has a hostname that was not found
* @see {Errors#HostNotFoundError}
*/
Sequelize.prototype.HostNotFoundError = Sequelize.HostNotFoundError =
sequelizeErrors.HostNotFoundError;
/**
* Thrown when a connection to a database has a hostname that was not reachable
* @see {Errors#HostNotReachableError}
*/
Sequelize.prototype.HostNotReachableError = Sequelize.HostNotReachableError =
sequelizeErrors.HostNotReachableError;
/**
* Thrown when a connection to a database has invalid values for any of the connection parameters
* @see {Errors#InvalidConnectionError}
*/
Sequelize.prototype.InvalidConnectionError = Sequelize.InvalidConnectionError =
sequelizeErrors.InvalidConnectionError;
/**
* Thrown when a connection to a database times out
* @see {Errors#ConnectionTimedOutError}
*/
Sequelize.prototype.ConnectionTimedOutError = Sequelize.ConnectionTimedOutError =
sequelizeErrors.ConnectionTimedOutError;
/**
* Thrown when a some problem occurred with Instance methods (see message for details)
* @see {Errors#InstanceError}
*/
Sequelize.prototype.InstanceError = Sequelize.InstanceError =
sequelizeErrors.InstanceError;
/**
* Thrown when a record was not found, Usually used with rejectOnEmpty mode (see message for details)
* @see {Errors#RecordNotFoundError}
*/
Sequelize.prototype.EmptyResultError = Sequelize.EmptyResultError =
sequelizeErrors.EmptyResultError;
......
......@@ -16,6 +16,8 @@ const uuid = require('node-uuid');
* @param {String} options.type=true Sets the type of the transaction.
* @param {String} options.isolationLevel=true Sets the isolation level of the transaction.
* @param {String} options.deferrable Sets the constraints to be deferred or immediately checked.
*
* @see {@link Sequelize.transaction}
*/
class Transaction {
constructor(sequelize, options) {
......@@ -183,7 +185,7 @@ class Transaction {
* // do something with the err.
* });
* ```
* @property DEFFERED
* @property DEFERRED
* @property IMMEDIATE
* @property EXCLUSIVE
*/
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!