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

Commit f48758d6 by Jan Aagaard Meier

Getting closer!

1 parent 4db5a5dd
...@@ -36,6 +36,8 @@ const HasOne = require('./has-one'); ...@@ -36,6 +36,8 @@ const HasOne = require('./has-one');
* *
* @class BelongsToMany * @class BelongsToMany
* @memberof Associations * @memberof Associations
*
* @see {@link Model.belongsToMany}
*/ */
class BelongsToMany extends Association { class BelongsToMany extends Association {
constructor(source, target, options) { constructor(source, target, options) {
...@@ -204,7 +206,7 @@ class BelongsToMany extends Association { ...@@ -204,7 +206,7 @@ class BelongsToMany extends Association {
* @param {Object} [options.where] An optional where clause to limit the associated models * @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|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 * @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>>} * @return {Promise<Array<Model>>}
* @method getAssociations * @method getAssociations
* @memberof Associations.BelongsToMany * @memberof Associations.BelongsToMany
......
...@@ -13,6 +13,8 @@ const Association = require('./base'); ...@@ -13,6 +13,8 @@ const Association = require('./base');
* *
* @class BelongsTo * @class BelongsTo
* @memberof Associations * @memberof Associations
*
* @see {@link Model.belongsTo}
*/ */
class BelongsTo extends Association { class BelongsTo extends Association {
constructor(source, target, options) { constructor(source, target, options) {
...@@ -101,7 +103,7 @@ class BelongsTo extends Association { ...@@ -101,7 +103,7 @@ class BelongsTo extends Association {
* *
* @param {Object} [values] * @param {Object} [values]
* @param {Object} [options] Options passed to `target.create` and setAssociation. * @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} * @return {Promise}
* @method createAssociation * @method createAssociation
* @memberof Associations.BelongsTo * @memberof Associations.BelongsTo
......
...@@ -12,6 +12,8 @@ const Association = require('./base'); ...@@ -12,6 +12,8 @@ const Association = require('./base');
* *
* @class HasMany * @class HasMany
* @memberof Associations * @memberof Associations
*
* @see {@link Model.hasMany}
*/ */
class HasMany extends Association { class HasMany extends Association {
constructor(source, target, options) { constructor(source, target, options) {
...@@ -98,7 +100,7 @@ class HasMany extends Association { ...@@ -98,7 +100,7 @@ class HasMany extends Association {
* @param {Object} [options.where] An optional where clause to limit the associated models * @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|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 * @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>>} * @return {Promise<Array<Model>>}
* @method getAssociations * @method getAssociations
* @memberof Associations.HasMany * @memberof Associations.HasMany
...@@ -344,8 +346,7 @@ class HasMany extends Association { ...@@ -344,8 +346,7 @@ class HasMany extends Association {
options = Utils.cloneDeep(options); options = Utils.cloneDeep(options);
options.attributes = [ 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.raw = true;
options.plain = true; options.plain = true;
......
...@@ -13,6 +13,8 @@ const Association = require('./base'); ...@@ -13,6 +13,8 @@ const Association = require('./base');
* *
* @class HasOne * @class HasOne
* @memberof Associations * @memberof Associations
*
* @see {@link Model.hasOne}
*/ */
class HasOne extends Association { class HasOne extends Association {
constructor(srcModel, targetModel, options) { constructor(srcModel, targetModel, options) {
...@@ -76,7 +78,7 @@ class HasOne extends Association { ...@@ -76,7 +78,7 @@ class HasOne extends Association {
* @param {Object} [options] * @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|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 * @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>} * @return {Promise<Model>}
* @method getAssociation * @method getAssociation
* @memberof Associations.HasOne * @memberof Associations.HasOne
...@@ -85,7 +87,7 @@ class HasOne extends Association { ...@@ -85,7 +87,7 @@ class HasOne extends Association {
/** /**
* Set the associated model. * 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` * @param {Object} [options] Options passed to getAssociation and `target.save`
* @return {Promise} * @return {Promise}
* @method setAssociation * @method setAssociation
...@@ -97,7 +99,7 @@ class HasOne extends Association { ...@@ -97,7 +99,7 @@ class HasOne extends Association {
* *
* @param {Object} [values] * @param {Object} [values]
* @param {Object} [options] Options passed to `target.create` and setAssociation. * @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} * @return {Promise}
* @method createAssociation * @method createAssociation
* @memberof Associations.HasOne * @memberof Associations.HasOne
......
...@@ -40,6 +40,8 @@ var util = require('util'); ...@@ -40,6 +40,8 @@ var util = require('util');
* @property INITIALLY_DEFERRED Defer constraints checks to the end of transactions. * @property INITIALLY_DEFERRED Defer constraints checks to the end of transactions.
* @property INITIALLY_IMMEDIATE Trigger the constraint checks immediately * @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 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 = { var Deferrable = module.exports = {
INITIALLY_DEFERRED, INITIALLY_DEFERRED,
...@@ -55,12 +57,6 @@ ABSTRACT.prototype.toString = function() { ...@@ -55,12 +57,6 @@ ABSTRACT.prototype.toString = function() {
return this.toSql.apply(this, arguments); return this.toSql.apply(this, arguments);
}; };
/**
* A property that will defer constraints checks to the end of transactions.
*
* @memberOf Sequelize.Deferrable
*/
function INITIALLY_DEFERRED() { function INITIALLY_DEFERRED() {
if (!(this instanceof INITIALLY_DEFERRED)) { if (!(this instanceof INITIALLY_DEFERRED)) {
return new INITIALLY_DEFERRED(); return new INITIALLY_DEFERRED();
...@@ -72,11 +68,6 @@ INITIALLY_DEFERRED.prototype.toSql = function() { ...@@ -72,11 +68,6 @@ INITIALLY_DEFERRED.prototype.toSql = function() {
return 'DEFERRABLE INITIALLY DEFERRED'; return 'DEFERRABLE INITIALLY DEFERRED';
}; };
/**
* A property that will trigger the constraint checks immediately
*
* @memberOf Sequelize.Deferrable
*/
function INITIALLY_IMMEDIATE() { function INITIALLY_IMMEDIATE() {
if (!(this instanceof INITIALLY_IMMEDIATE)) { if (!(this instanceof INITIALLY_IMMEDIATE)) {
return new INITIALLY_IMMEDIATE(); return new INITIALLY_IMMEDIATE();
...@@ -88,13 +79,6 @@ INITIALLY_IMMEDIATE.prototype.toSql = function() { ...@@ -88,13 +79,6 @@ INITIALLY_IMMEDIATE.prototype.toSql = function() {
return 'DEFERRABLE INITIALLY IMMEDIATE'; 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() { function NOT() {
if (!(this instanceof NOT)) { if (!(this instanceof NOT)) {
return new NOT(); return new NOT();
...@@ -106,14 +90,6 @@ NOT.prototype.toSql = function() { ...@@ -106,14 +90,6 @@ NOT.prototype.toSql = function() {
return 'NOT DEFERRABLE'; 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) { function SET_DEFERRED(constraints) {
if (!(this instanceof SET_DEFERRED)) { if (!(this instanceof SET_DEFERRED)) {
return new SET_DEFERRED(constraints); return new SET_DEFERRED(constraints);
...@@ -127,14 +103,6 @@ SET_DEFERRED.prototype.toSql = function(queryGenerator) { ...@@ -127,14 +103,6 @@ SET_DEFERRED.prototype.toSql = function(queryGenerator) {
return queryGenerator.setDeferredQuery(this.constraints); 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) { function SET_IMMEDIATE(constraints) {
if (!(this instanceof SET_IMMEDIATE)) { if (!(this instanceof SET_IMMEDIATE)) {
return new SET_IMMEDIATE(constraints); return new SET_IMMEDIATE(constraints);
......
...@@ -17,6 +17,7 @@ const parserMap = new Map(); ...@@ -17,6 +17,7 @@ const parserMap = new Map();
* *
* @extends AbstractConnectionManager * @extends AbstractConnectionManager
* @return Class<ConnectionManager> * @return Class<ConnectionManager>
* @private
*/ */
class ConnectionManager extends AbstractConnectionManager { class ConnectionManager extends AbstractConnectionManager {
...@@ -65,6 +66,7 @@ class ConnectionManager extends AbstractConnectionManager { ...@@ -65,6 +66,7 @@ class ConnectionManager extends AbstractConnectionManager {
* Also set proper timezone once conection is connected * Also set proper timezone once conection is connected
* *
* @return Promise<Connection> * @return Promise<Connection>
* @private
*/ */
connect(config) { connect(config) {
const connectionConfig = { const connectionConfig = {
......
...@@ -4,7 +4,8 @@ ...@@ -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. * 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. * 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 * @namespace Errors
*/ */
...@@ -127,6 +128,9 @@ exports.TimeoutError = TimeoutError; ...@@ -127,6 +128,9 @@ exports.TimeoutError = TimeoutError;
* Thrown when a unique constraint is violated in the database * Thrown when a unique constraint is violated in the database
* @extends DatabaseError * @extends DatabaseError
* @memberof Errors * @memberof Errors
*
* @property
* @property sql
*/ */
class UniqueConstraintError extends ValidationError { class UniqueConstraintError extends ValidationError {
constructor(options) { constructor(options) {
...@@ -214,15 +218,13 @@ exports.ValidationErrorItem = ValidationErrorItem; ...@@ -214,15 +218,13 @@ exports.ValidationErrorItem = ValidationErrorItem;
* A base class for all connection related errors. * A base class for all connection related errors.
* @extends BaseError * @extends BaseError
* @memberof Errors * @memberof Errors
*
* @property parent The connection specific error which triggered this one
*/ */
class ConnectionError extends BaseError { class ConnectionError extends BaseError {
constructor(parent) { constructor(parent) {
super(parent ? parent.message : ''); super(parent ? parent.message : '');
this.name = 'SequelizeConnectionError'; this.name = 'SequelizeConnectionError';
/**
* The connection specific error which triggered this one
* @member parent
*/
this.parent = parent; this.parent = parent;
this.original = parent; this.original = parent;
} }
...@@ -246,7 +248,6 @@ exports.ConnectionRefusedError = ConnectionRefusedError; ...@@ -246,7 +248,6 @@ exports.ConnectionRefusedError = ConnectionRefusedError;
* Thrown when a connection to a database is refused due to insufficient privileges * Thrown when a connection to a database is refused due to insufficient privileges
* @extends ConnectionError * @extends ConnectionError
* @memberof Errors * @memberof Errors
* @memberof Sequelize
*/ */
class AccessDeniedError extends ConnectionError { class AccessDeniedError extends ConnectionError {
constructor(parent) { constructor(parent) {
......
...@@ -4,39 +4,6 @@ const Utils = require('./utils'); ...@@ -4,39 +4,6 @@ const Utils = require('./utils');
const Promise = require('./promise'); const Promise = require('./promise');
const debug = Utils.getLogger().debugContext('hooks'); 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 = { const hookTypes = {
beforeValidate: {params: 2}, beforeValidate: {params: 2},
afterValidate: {params: 2}, afterValidate: {params: 2},
...@@ -162,11 +129,12 @@ const Hooks = { ...@@ -162,11 +129,12 @@ const Hooks = {
/** /**
* Add a hook to the model * 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 {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 * @param {Function} fn The hook function
* *
* @alias hook * @memberOf Sequelize
* @memberOf Sequelize.Model
*/ */
addHook(hookType, name, fn) { addHook(hookType, name, fn) {
if (typeof name === 'function') { if (typeof name === 'function') {
...@@ -193,6 +161,9 @@ const Hooks = { ...@@ -193,6 +161,9 @@ const Hooks = {
* *
* @param {String} hookType * @param {String} hookType
* @param {String|Function} name * @param {String|Function} name
*
* @memberOf Sequelize
* @memberOf Sequelize.Model
*/ */
removeHook(hookType, name) { removeHook(hookType, name) {
hookType = hookAliases[hookType] || hookType; hookType = hookAliases[hookType] || hookType;
...@@ -226,6 +197,8 @@ const Hooks = { ...@@ -226,6 +197,8 @@ const Hooks = {
* @param {String} hookType * @param {String} hookType
* *
* @alias hasHooks * @alias hasHooks
* @memberOf Sequelize
* @memberOf Sequelize.Model
*/ */
hasHook(hookType) { hasHook(hookType) {
return this.options.hooks[hookType] && !!this.options.hooks[hookType].length; return this.options.hooks[hookType] && !!this.options.hooks[hookType].length;
...@@ -251,6 +224,7 @@ exports.applyTo = applyTo; ...@@ -251,6 +224,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with instance, options * @param {Function} fn A callback function that is called with instance, options
* @name beforeValidate * @name beforeValidate
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -258,6 +232,7 @@ exports.applyTo = applyTo; ...@@ -258,6 +232,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with instance, options * @param {Function} fn A callback function that is called with instance, options
* @name afterValidate * @name afterValidate
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -266,6 +241,7 @@ exports.applyTo = applyTo; ...@@ -266,6 +241,7 @@ exports.applyTo = applyTo;
* @param {Function} fn A callback function that is called with instance, options, error. Error is the * @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. * SequelizeValidationError. If the callback throws an error, it will replace the original validation error.
* @name validationFailed * @name validationFailed
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -273,6 +249,7 @@ exports.applyTo = applyTo; ...@@ -273,6 +249,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with attributes, options * @param {Function} fn A callback function that is called with attributes, options
* @name beforeCreate * @name beforeCreate
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -280,6 +257,7 @@ exports.applyTo = applyTo; ...@@ -280,6 +257,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with attributes, options * @param {Function} fn A callback function that is called with attributes, options
* @name afterCreate * @name afterCreate
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -287,6 +265,7 @@ exports.applyTo = applyTo; ...@@ -287,6 +265,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with attributes, options * @param {Function} fn A callback function that is called with attributes, options
* @name beforeSave * @name beforeSave
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -294,6 +273,7 @@ exports.applyTo = applyTo; ...@@ -294,6 +273,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with attributes, options * @param {Function} fn A callback function that is called with attributes, options
* @name beforeUpsert * @name beforeUpsert
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -301,6 +281,7 @@ exports.applyTo = applyTo; ...@@ -301,6 +281,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with attributes, options * @param {Function} fn A callback function that is called with attributes, options
* @name afterUpsert * @name afterUpsert
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -308,6 +289,7 @@ exports.applyTo = applyTo; ...@@ -308,6 +289,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with attributes, options * @param {Function} fn A callback function that is called with attributes, options
* @name afterSave * @name afterSave
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -317,6 +299,7 @@ exports.applyTo = applyTo; ...@@ -317,6 +299,7 @@ exports.applyTo = applyTo;
* *
* @name beforeDestroy * @name beforeDestroy
* @alias beforeDelete * @alias beforeDelete
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -326,6 +309,7 @@ exports.applyTo = applyTo; ...@@ -326,6 +309,7 @@ exports.applyTo = applyTo;
* *
* @name afterDestroy * @name afterDestroy
* @alias afterDelete * @alias afterDelete
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -334,6 +318,7 @@ exports.applyTo = applyTo; ...@@ -334,6 +318,7 @@ exports.applyTo = applyTo;
* @param {Function} fn A callback function that is called with instance, options * @param {Function} fn A callback function that is called with instance, options
* *
* @name beforeRestore * @name beforeRestore
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -342,6 +327,7 @@ exports.applyTo = applyTo; ...@@ -342,6 +327,7 @@ exports.applyTo = applyTo;
* @param {Function} fn A callback function that is called with instance, options * @param {Function} fn A callback function that is called with instance, options
* *
* @name afterRestore * @name afterRestore
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -349,6 +335,7 @@ exports.applyTo = applyTo; ...@@ -349,6 +335,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with instance, options * @param {Function} fn A callback function that is called with instance, options
* @name beforeUpdate * @name beforeUpdate
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -356,6 +343,7 @@ exports.applyTo = applyTo; ...@@ -356,6 +343,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with instance, options * @param {Function} fn A callback function that is called with instance, options
* @name afterUpdate * @name afterUpdate
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -363,6 +351,7 @@ exports.applyTo = applyTo; ...@@ -363,6 +351,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with instances, options * @param {Function} fn A callback function that is called with instances, options
* @name beforeBulkCreate * @name beforeBulkCreate
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -370,6 +359,7 @@ exports.applyTo = applyTo; ...@@ -370,6 +359,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with instances, options * @param {Function} fn A callback function that is called with instances, options
* @name afterBulkCreate * @name afterBulkCreate
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -379,6 +369,7 @@ exports.applyTo = applyTo; ...@@ -379,6 +369,7 @@ exports.applyTo = applyTo;
* *
* @name beforeBulkDestroy * @name beforeBulkDestroy
* @alias beforeBulkDelete * @alias beforeBulkDelete
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -388,6 +379,7 @@ exports.applyTo = applyTo; ...@@ -388,6 +379,7 @@ exports.applyTo = applyTo;
* *
* @name afterBulkDestroy * @name afterBulkDestroy
* @alias afterBulkDelete * @alias afterBulkDelete
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -396,6 +388,7 @@ exports.applyTo = applyTo; ...@@ -396,6 +388,7 @@ exports.applyTo = applyTo;
* @param {Function} fn A callback function that is called with options * @param {Function} fn A callback function that is called with options
* *
* @name beforeBulkRestore * @name beforeBulkRestore
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -404,6 +397,7 @@ exports.applyTo = applyTo; ...@@ -404,6 +397,7 @@ exports.applyTo = applyTo;
* @param {Function} fn A callback function that is called with options * @param {Function} fn A callback function that is called with options
* *
* @name afterBulkRestore * @name afterBulkRestore
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -411,6 +405,7 @@ exports.applyTo = applyTo; ...@@ -411,6 +405,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with options * @param {Function} fn A callback function that is called with options
* @name beforeBulkUpdate * @name beforeBulkUpdate
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -418,6 +413,7 @@ exports.applyTo = applyTo; ...@@ -418,6 +413,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with options * @param {Function} fn A callback function that is called with options
* @name afterBulkUpdate * @name afterBulkUpdate
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -425,6 +421,7 @@ exports.applyTo = applyTo; ...@@ -425,6 +421,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with options * @param {Function} fn A callback function that is called with options
* @name beforeFind * @name beforeFind
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -432,6 +429,7 @@ exports.applyTo = applyTo; ...@@ -432,6 +429,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with options * @param {Function} fn A callback function that is called with options
* @name beforeFindAfterExpandIncludeAll * @name beforeFindAfterExpandIncludeAll
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -439,6 +437,7 @@ exports.applyTo = applyTo; ...@@ -439,6 +437,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with options * @param {Function} fn A callback function that is called with options
* @name beforeFindAfterOptions * @name beforeFindAfterOptions
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -446,6 +445,7 @@ exports.applyTo = applyTo; ...@@ -446,6 +445,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with instance(s), options * @param {Function} fn A callback function that is called with instance(s), options
* @name afterFind * @name afterFind
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -453,6 +453,7 @@ exports.applyTo = applyTo; ...@@ -453,6 +453,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with options * @param {Function} fn A callback function that is called with options
* @name beforeCount * @name beforeCount
* @memberOf Sequelize.Model
*/ */
/** /**
...@@ -460,6 +461,7 @@ exports.applyTo = applyTo; ...@@ -460,6 +461,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with attributes, options * @param {Function} fn A callback function that is called with attributes, options
* @name beforeDefine * @name beforeDefine
* @memberOf Sequelize
*/ */
/** /**
...@@ -467,6 +469,7 @@ exports.applyTo = applyTo; ...@@ -467,6 +469,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with factory * @param {Function} fn A callback function that is called with factory
* @name afterDefine * @name afterDefine
* @memberOf Sequelize
*/ */
/** /**
...@@ -474,6 +477,7 @@ exports.applyTo = applyTo; ...@@ -474,6 +477,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with config, options * @param {Function} fn A callback function that is called with config, options
* @name beforeInit * @name beforeInit
* @memberOf Sequelize
*/ */
/** /**
...@@ -481,6 +485,7 @@ exports.applyTo = applyTo; ...@@ -481,6 +485,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with sequelize * @param {Function} fn A callback function that is called with sequelize
* @name afterInit * @name afterInit
* @memberOf Sequelize
*/ */
/** /**
...@@ -488,6 +493,7 @@ exports.applyTo = applyTo; ...@@ -488,6 +493,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with config passed to connection * @param {Function} fn A callback function that is called with config passed to connection
* @name beforeConnect * @name beforeConnect
* @memberOf Sequelize
*/ */
/** /**
...@@ -495,6 +501,7 @@ exports.applyTo = applyTo; ...@@ -495,6 +501,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with options passed to Model.sync * @param {Function} fn A callback function that is called with options passed to Model.sync
* @name beforeSync * @name beforeSync
* @memberOf Sequelize
*/ */
/** /**
...@@ -502,6 +509,7 @@ exports.applyTo = applyTo; ...@@ -502,6 +509,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with options passed to Model.sync * @param {Function} fn A callback function that is called with options passed to Model.sync
* @name afterSync * @name afterSync
* @memberOf Sequelize
*/ */
/** /**
...@@ -509,6 +517,7 @@ exports.applyTo = applyTo; ...@@ -509,6 +517,7 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with options passed to sequelize.sync * @param {Function} fn A callback function that is called with options passed to sequelize.sync
* @name beforeBulkSync * @name beforeBulkSync
* @memberOf Sequelize
*/ */
/** /**
...@@ -516,4 +525,5 @@ exports.applyTo = applyTo; ...@@ -516,4 +525,5 @@ exports.applyTo = applyTo;
* @param {String} name * @param {String} name
* @param {Function} fn A callback function that is called with options passed to sequelize.sync * @param {Function} fn A callback function that is called with options passed to sequelize.sync
* @name afterBulkSync * @name afterBulkSync
* @memberOf Sequelize
*/ */
...@@ -607,21 +607,16 @@ class Model { ...@@ -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. * 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 a list of possible data types, see {@link DataTypes}
*
* 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 more about validation, see http://docs.sequelizejs.com/en/latest/docs/models-definition/#validations * For more about validation, see http://docs.sequelizejs.com/en/latest/docs/models-definition/#validations
* *
* @see {@link DataTypes} * @see {@link DataTypes}
* @see {@link Hooks} * @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 {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|DataTypes|Object} attributes.column The description of a database column
* @param {String|DataType} attributes.column.type A string or a data type * @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 {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 {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 * @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 { ...@@ -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.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|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 {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.schema='public']
* @param {String} [options.engine] * @param {String} [options.engine]
* @param {String} [options.charset] * @param {String} [options.charset]
...@@ -2991,7 +2984,7 @@ class Model { ...@@ -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. * 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 {String|Object} key
* @param {any} value * @param {any} value
* @param {Object} [options] * @param {Object} [options]
...@@ -3463,7 +3456,7 @@ class Model { ...@@ -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, * 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. * 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 {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. * @param {Function} [options.logging=false] A function that gets executed while running the query to log the sql.
* *
......
'use strict'; '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 = { module.exports = {
SELECT: 'SELECT', SELECT: 'SELECT',
INSERT: 'INSERT', INSERT: 'INSERT',
......
...@@ -28,7 +28,6 @@ const _ = require('lodash'); ...@@ -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. * 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 * @class Sequelize
* @lands Errors
*/ */
/** /**
...@@ -286,6 +285,7 @@ class Sequelize { ...@@ -286,6 +285,7 @@ class Sequelize {
* Returns an instance of QueryInterface. * Returns an instance of QueryInterface.
* @method getQueryInterface * @method getQueryInterface
* @memberOf Sequelize
* @return {QueryInterface} An instance (singleton) of QueryInterface. * @return {QueryInterface} An instance (singleton) of QueryInterface.
*/ */
getQueryInterface() { getQueryInterface() {
...@@ -331,8 +331,8 @@ class Sequelize { ...@@ -331,8 +331,8 @@ class Sequelize {
* *
* For more about validation, see http://docs.sequelizejs.com/en/latest/docs/models-definition/#validations * For more about validation, see http://docs.sequelizejs.com/en/latest/docs/models-definition/#validations
* *
* @see {DataTypes} * @see {@link DataTypes}
* @see {Hooks} * @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 {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} 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() * @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 { ...@@ -802,7 +802,6 @@ class Sequelize {
* }) * })
* ``` * ```
* *
* @see {@link Model#find}
* @see {@link Model#findAll} * @see {@link Model#findAll}
* @see {@link Model#define} * @see {@link Model#define}
* @see {@link Sequelize#col} * @see {@link Sequelize#col}
...@@ -863,7 +862,7 @@ class Sequelize { ...@@ -863,7 +862,7 @@ class Sequelize {
/** /**
* An AND query * An AND query
* @see {@link Model#find} * @see {@link Model#findAll}
* *
* @method and * @method and
* @param {String|Object} args Each argument will be joined by AND * @param {String|Object} args Each argument will be joined by AND
...@@ -877,7 +876,7 @@ class Sequelize { ...@@ -877,7 +876,7 @@ class Sequelize {
/** /**
* An OR query * An OR query
* @see {@link Model#find} * @see {@link Model#findAll}
* *
* @method or * @method or
* @param {String|Object} args Each argument will be joined by OR * @param {String|Object} args Each argument will be joined by OR
...@@ -891,7 +890,7 @@ class Sequelize { ...@@ -891,7 +890,7 @@ class Sequelize {
/** /**
* Creates an object representing nested where conditions for postgres's json data-type. * Creates an object representing nested where conditions for postgres's json data-type.
* @see {@link Model#find} * @see {@link Model#findAll}
* *
* @method json * @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. * @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 { ...@@ -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`. * 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 {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='='] * @param {string} [comparator='=']
...@@ -1141,6 +1140,7 @@ Sequelize.prototype.Promise = Sequelize.Promise = Promise; ...@@ -1141,6 +1140,7 @@ Sequelize.prototype.Promise = Sequelize.Promise = Promise;
/** /**
* Available query types for use with `sequelize.query` * Available query types for use with `sequelize.query`
* @see {@link Sequelize.QueryTypes}
*/ */
Sequelize.prototype.QueryTypes = Sequelize.QueryTypes = QueryTypes; Sequelize.prototype.QueryTypes = Sequelize.QueryTypes = QueryTypes;
...@@ -1190,122 +1190,54 @@ Sequelize.useInflection = Utils.useInflection; ...@@ -1190,122 +1190,54 @@ Sequelize.useInflection = Utils.useInflection;
Hooks.applyTo(Sequelize); Hooks.applyTo(Sequelize);
Hooks.applyTo(Sequelize.prototype); Hooks.applyTo(Sequelize.prototype);
/**
* A general error class
* @see {Errors#BaseError}
*/
Sequelize.prototype.Error = Sequelize.Error = Sequelize.prototype.Error = Sequelize.Error =
sequelizeErrors.BaseError; sequelizeErrors.BaseError;
/**
* Emitted when a validation fails
* @see {Errors#ValidationError}
*/
Sequelize.prototype.ValidationError = Sequelize.ValidationError = Sequelize.prototype.ValidationError = Sequelize.ValidationError =
sequelizeErrors.ValidationError; sequelizeErrors.ValidationError;
/**
* Describes a validation error on an instance path
* @see {Errors#ValidationErrorItem}
*/
Sequelize.prototype.ValidationErrorItem = Sequelize.ValidationErrorItem = Sequelize.prototype.ValidationErrorItem = Sequelize.ValidationErrorItem =
sequelizeErrors.ValidationErrorItem; sequelizeErrors.ValidationErrorItem;
/**
* A base class for all database related errors.
* @see {Errors#DatabaseError}
*/
Sequelize.prototype.DatabaseError = Sequelize.DatabaseError = Sequelize.prototype.DatabaseError = Sequelize.DatabaseError =
sequelizeErrors.DatabaseError; sequelizeErrors.DatabaseError;
/**
* Thrown when a database query times out because of a deadlock
* @see {Errors#TimeoutError}
*/
Sequelize.prototype.TimeoutError = Sequelize.TimeoutError = Sequelize.prototype.TimeoutError = Sequelize.TimeoutError =
sequelizeErrors.TimeoutError; sequelizeErrors.TimeoutError;
/**
* Thrown when a unique constraint is violated in the database
* @see {Errors#UniqueConstraintError}
*/
Sequelize.prototype.UniqueConstraintError = Sequelize.UniqueConstraintError = Sequelize.prototype.UniqueConstraintError = Sequelize.UniqueConstraintError =
sequelizeErrors.UniqueConstraintError; sequelizeErrors.UniqueConstraintError;
/**
* Thrown when an exclusion constraint is violated in the database
* @see {Errors#ExclusionConstraintError}
*/
Sequelize.prototype.ExclusionConstraintError = Sequelize.ExclusionConstraintError = Sequelize.prototype.ExclusionConstraintError = Sequelize.ExclusionConstraintError =
sequelizeErrors.ExclusionConstraintError; sequelizeErrors.ExclusionConstraintError;
/**
* Thrown when a foreign key constraint is violated in the database
* @see {Errors#ForeignKeyConstraintError}
*/
Sequelize.prototype.ForeignKeyConstraintError = Sequelize.ForeignKeyConstraintError = Sequelize.prototype.ForeignKeyConstraintError = Sequelize.ForeignKeyConstraintError =
sequelizeErrors.ForeignKeyConstraintError; sequelizeErrors.ForeignKeyConstraintError;
/**
* A base class for all connection related errors.
* @see {Errors#ConnectionError}
*/
Sequelize.prototype.ConnectionError = Sequelize.ConnectionError = Sequelize.prototype.ConnectionError = Sequelize.ConnectionError =
sequelizeErrors.ConnectionError; sequelizeErrors.ConnectionError;
/**
* Thrown when a connection to a database is refused
* @see {Errors#ConnectionRefusedError}
*/
Sequelize.prototype.ConnectionRefusedError = Sequelize.ConnectionRefusedError = Sequelize.prototype.ConnectionRefusedError = Sequelize.ConnectionRefusedError =
sequelizeErrors.ConnectionRefusedError; sequelizeErrors.ConnectionRefusedError;
/**
* Thrown when a connection to a database is refused due to insufficient access
* @see {Errors#AccessDeniedError}
*/
Sequelize.prototype.AccessDeniedError = Sequelize.AccessDeniedError = Sequelize.prototype.AccessDeniedError = Sequelize.AccessDeniedError =
sequelizeErrors.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 = Sequelize.prototype.HostNotFoundError = Sequelize.HostNotFoundError =
sequelizeErrors.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 = Sequelize.prototype.HostNotReachableError = Sequelize.HostNotReachableError =
sequelizeErrors.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 = Sequelize.prototype.InvalidConnectionError = Sequelize.InvalidConnectionError =
sequelizeErrors.InvalidConnectionError; sequelizeErrors.InvalidConnectionError;
/**
* Thrown when a connection to a database times out
* @see {Errors#ConnectionTimedOutError}
*/
Sequelize.prototype.ConnectionTimedOutError = Sequelize.ConnectionTimedOutError = Sequelize.prototype.ConnectionTimedOutError = Sequelize.ConnectionTimedOutError =
sequelizeErrors.ConnectionTimedOutError; sequelizeErrors.ConnectionTimedOutError;
/**
* Thrown when a some problem occurred with Instance methods (see message for details)
* @see {Errors#InstanceError}
*/
Sequelize.prototype.InstanceError = Sequelize.InstanceError = Sequelize.prototype.InstanceError = Sequelize.InstanceError =
sequelizeErrors.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 = Sequelize.prototype.EmptyResultError = Sequelize.EmptyResultError =
sequelizeErrors.EmptyResultError; sequelizeErrors.EmptyResultError;
......
...@@ -16,6 +16,8 @@ const uuid = require('node-uuid'); ...@@ -16,6 +16,8 @@ const uuid = require('node-uuid');
* @param {String} options.type=true Sets the type of the transaction. * @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.isolationLevel=true Sets the isolation level of the transaction.
* @param {String} options.deferrable Sets the constraints to be deferred or immediately checked. * @param {String} options.deferrable Sets the constraints to be deferred or immediately checked.
*
* @see {@link Sequelize.transaction}
*/ */
class Transaction { class Transaction {
constructor(sequelize, options) { constructor(sequelize, options) {
...@@ -183,7 +185,7 @@ class Transaction { ...@@ -183,7 +185,7 @@ class Transaction {
* // do something with the err. * // do something with the err.
* }); * });
* ``` * ```
* @property DEFFERED * @property DEFERRED
* @property IMMEDIATE * @property IMMEDIATE
* @property EXCLUSIVE * @property EXCLUSIVE
*/ */
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!