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

You need to sign in or sign up before continuing.
Commit 3d2dd9c5 by Jan Aagaard Meier

[ci skip] docs(generate) Apply api doc changes from #5311

1 parent 3e5b8772
<a name="belongstomany"></a> <a name="belongstomany"></a>
# Mixin BelongsToMany # Mixin BelongsToMany
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/belongs-to-many.js#L41) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/belongs-to-many.js#L41)
Many-to-many association with a join table. Many-to-many association with a join table.
...@@ -31,7 +31,7 @@ In the API reference below, replace `Assocation(s)` with the actual name of your ...@@ -31,7 +31,7 @@ In the API reference below, replace `Assocation(s)` with the actual name of your
<a name="getassociations"></a> <a name="getassociations"></a>
## `getAssociations([options])` -> `Promise.<Array.<Instance>>` ## `getAssociations([options])` -> `Promise.<Array.<Instance>>`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/belongs-to-many.js#L209) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/belongs-to-many.js#L209)
Get everything currently associated with this, using an optional where clause. Get everything currently associated with this, using an optional where clause.
...@@ -49,7 +49,7 @@ Get everything currently associated with this, using an optional where clause. ...@@ -49,7 +49,7 @@ Get everything currently associated with this, using an optional where clause.
<a name="setassociations"></a> <a name="setassociations"></a>
## `setAssociations([newAssociations], [options])` -> `Promise` ## `setAssociations([newAssociations], [options])` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/belongs-to-many.js#L219) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/belongs-to-many.js#L219)
Set the associated models by passing an array of instances or their primary keys. Everything that it not in the passed array will be un-associated. Set the associated models by passing an array of instances or their primary keys. Everything that it not in the passed array will be un-associated.
...@@ -66,7 +66,7 @@ Set the associated models by passing an array of instances or their primary keys ...@@ -66,7 +66,7 @@ Set the associated models by passing an array of instances or their primary keys
<a name="addassociations"></a> <a name="addassociations"></a>
## `addAssociations([newAssociations], [options])` -> `Promise` ## `addAssociations([newAssociations], [options])` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/belongs-to-many.js#L229) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/belongs-to-many.js#L229)
Associate several instances with this. Associate several instances with this.
...@@ -83,7 +83,7 @@ Associate several instances with this. ...@@ -83,7 +83,7 @@ Associate several instances with this.
<a name="addassociation"></a> <a name="addassociation"></a>
## `addAssociation([newAssociation], [options])` -> `Promise` ## `addAssociation([newAssociation], [options])` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/belongs-to-many.js#L239) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/belongs-to-many.js#L239)
Associate one instance with this. Associate one instance with this.
...@@ -100,7 +100,7 @@ Associate one instance with this. ...@@ -100,7 +100,7 @@ Associate one instance with this.
<a name="createassociation"></a> <a name="createassociation"></a>
## `createAssociation([values], [options])` -> `Promise` ## `createAssociation([values], [options])` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/belongs-to-many.js#L248) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/belongs-to-many.js#L248)
Create a new instance of the associated model and associate it with this. Create a new instance of the associated model and associate it with this.
...@@ -116,7 +116,7 @@ Create a new instance of the associated model and associate it with this. ...@@ -116,7 +116,7 @@ Create a new instance of the associated model and associate it with this.
<a name="removeassociation"></a> <a name="removeassociation"></a>
## `removeAssociation([oldAssociated], [options])` -> `Promise` ## `removeAssociation([oldAssociated], [options])` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/belongs-to-many.js#L257) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/belongs-to-many.js#L257)
Un-associate the instance. Un-associate the instance.
...@@ -132,7 +132,7 @@ Un-associate the instance. ...@@ -132,7 +132,7 @@ Un-associate the instance.
<a name="removeassociations"></a> <a name="removeassociations"></a>
## `removeAssociations([oldAssociated], [options])` -> `Promise` ## `removeAssociations([oldAssociated], [options])` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/belongs-to-many.js#L266) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/belongs-to-many.js#L266)
Un-associate several instances. Un-associate several instances.
...@@ -148,7 +148,7 @@ Un-associate several instances. ...@@ -148,7 +148,7 @@ Un-associate several instances.
<a name="hasassociation"></a> <a name="hasassociation"></a>
## `hasAssociation([instance], [options])` -> `Promise` ## `hasAssociation([instance], [options])` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/belongs-to-many.js#L275) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/belongs-to-many.js#L275)
Check if an instance is associated with this. Check if an instance is associated with this.
...@@ -164,7 +164,7 @@ Check if an instance is associated with this. ...@@ -164,7 +164,7 @@ Check if an instance is associated with this.
<a name="hasassociations"></a> <a name="hasassociations"></a>
## `hasAssociations([instances], [options])` -> `Promise` ## `hasAssociations([instances], [options])` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/belongs-to-many.js#L284) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/belongs-to-many.js#L284)
Check if all instances are associated with this. Check if all instances are associated with this.
...@@ -180,7 +180,7 @@ Check if all instances are associated with this. ...@@ -180,7 +180,7 @@ Check if all instances are associated with this.
<a name="countassociations"></a> <a name="countassociations"></a>
## `countAssociations([options])` -> `Promise.<Int>` ## `countAssociations([options])` -> `Promise.<Int>`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/belongs-to-many.js#L294) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/belongs-to-many.js#L294)
Count everything currently associated with this, using an optional where clause. Count everything currently associated with this, using an optional where clause.
......
<a name="belongsto"></a> <a name="belongsto"></a>
# Mixin BelongsTo # Mixin BelongsTo
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/belongs-to.js#L17) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/belongs-to.js#L17)
One-to-one association One-to-one association
...@@ -10,7 +10,7 @@ In the API reference below, replace `Assocation` with the actual name of your as ...@@ -10,7 +10,7 @@ In the API reference below, replace `Assocation` with the actual name of your as
<a name="getassociation"></a> <a name="getassociation"></a>
## `getAssociation([options])` -> `Promise.<Instance>` ## `getAssociation([options])` -> `Promise.<Instance>`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/belongs-to.js#L83) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/belongs-to.js#L83)
Get the associated instance. Get the associated instance.
...@@ -27,7 +27,7 @@ Get the associated instance. ...@@ -27,7 +27,7 @@ Get the associated instance.
<a name="setassociation"></a> <a name="setassociation"></a>
## `setAssociation([newAssociation], [options])` -> `Promise` ## `setAssociation([newAssociation], [options])` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/belongs-to.js#L93) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/belongs-to.js#L93)
Set the associated model. Set the associated model.
...@@ -44,7 +44,7 @@ Set the associated model. ...@@ -44,7 +44,7 @@ Set the associated model.
<a name="createassociation"></a> <a name="createassociation"></a>
## `createAssociation([values], [options])` -> `Promise` ## `createAssociation([values], [options])` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/belongs-to.js#L102) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/belongs-to.js#L102)
Create a new instance of the associated model and associate it with this. Create a new instance of the associated model and associate it with this.
......
<a name="hasmany"></a> <a name="hasmany"></a>
# Mixin HasMany # Mixin HasMany
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/has-many.js#L17) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/has-many.js#L17)
One-to-many association One-to-many association
...@@ -10,7 +10,7 @@ In the API reference below, replace `Association(s)` with the actual name of you ...@@ -10,7 +10,7 @@ In the API reference below, replace `Association(s)` with the actual name of you
<a name="getassociations"></a> <a name="getassociations"></a>
## `getAssociations([options])` -> `Promise.<Array.<Instance>>` ## `getAssociations([options])` -> `Promise.<Array.<Instance>>`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/has-many.js#L104) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/has-many.js#L104)
Get everything currently associated with this, using an optional where clause. Get everything currently associated with this, using an optional where clause.
...@@ -28,7 +28,7 @@ Get everything currently associated with this, using an optional where clause. ...@@ -28,7 +28,7 @@ Get everything currently associated with this, using an optional where clause.
<a name="setassociations"></a> <a name="setassociations"></a>
## `setAssociations([newAssociations], [options])` -> `Promise` ## `setAssociations([newAssociations], [options])` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/has-many.js#L114) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/has-many.js#L114)
Set the associated models by passing an array of instances or their primary keys. Everything that is not in the passed array will be un-associated Set the associated models by passing an array of instances or their primary keys. Everything that is not in the passed array will be un-associated
...@@ -45,7 +45,7 @@ Set the associated models by passing an array of instances or their primary keys ...@@ -45,7 +45,7 @@ Set the associated models by passing an array of instances or their primary keys
<a name="addassociations"></a> <a name="addassociations"></a>
## `addAssociations([newAssociations], [options])` -> `Promise` ## `addAssociations([newAssociations], [options])` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/has-many.js#L124) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/has-many.js#L124)
Associate several instances with this. Associate several instances with this.
...@@ -62,7 +62,7 @@ Associate several instances with this. ...@@ -62,7 +62,7 @@ Associate several instances with this.
<a name="addassociation"></a> <a name="addassociation"></a>
## `addAssociation([newAssociation], [options])` -> `Promise` ## `addAssociation([newAssociation], [options])` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/has-many.js#L134) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/has-many.js#L134)
Associate one instance with this. Associate one instance with this.
...@@ -79,7 +79,7 @@ Associate one instance with this. ...@@ -79,7 +79,7 @@ Associate one instance with this.
<a name="createassociation"></a> <a name="createassociation"></a>
## `createAssociation([values], [options])` -> `Promise` ## `createAssociation([values], [options])` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/has-many.js#L143) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/has-many.js#L143)
Create a new instance of the associated model and associate it with this. Create a new instance of the associated model and associate it with this.
...@@ -95,7 +95,7 @@ Create a new instance of the associated model and associate it with this. ...@@ -95,7 +95,7 @@ Create a new instance of the associated model and associate it with this.
<a name="removeassociation"></a> <a name="removeassociation"></a>
## `removeAssociation([oldAssociated], [options])` -> `Promise` ## `removeAssociation([oldAssociated], [options])` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/has-many.js#L152) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/has-many.js#L152)
Un-associate the instance. Un-associate the instance.
...@@ -111,7 +111,7 @@ Un-associate the instance. ...@@ -111,7 +111,7 @@ Un-associate the instance.
<a name="removeassociations"></a> <a name="removeassociations"></a>
## `removeAssociations([oldAssociatedArray], [options])` -> `Promise` ## `removeAssociations([oldAssociatedArray], [options])` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/has-many.js#L161) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/has-many.js#L161)
Un-associate several instances. Un-associate several instances.
...@@ -127,7 +127,7 @@ Un-associate several instances. ...@@ -127,7 +127,7 @@ Un-associate several instances.
<a name="hasassociation"></a> <a name="hasassociation"></a>
## `hasAssociation([instance], [options])` -> `Promise` ## `hasAssociation([instance], [options])` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/has-many.js#L170) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/has-many.js#L170)
Check if an instance is associated with this. Check if an instance is associated with this.
...@@ -143,7 +143,7 @@ Check if an instance is associated with this. ...@@ -143,7 +143,7 @@ Check if an instance is associated with this.
<a name="hasassociations"></a> <a name="hasassociations"></a>
## `hasAssociations([instances], [options])` -> `Promise` ## `hasAssociations([instances], [options])` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/has-many.js#L179) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/has-many.js#L179)
Check if all instances are associated with this. Check if all instances are associated with this.
...@@ -159,7 +159,7 @@ Check if all instances are associated with this. ...@@ -159,7 +159,7 @@ Check if all instances are associated with this.
<a name="countassociations"></a> <a name="countassociations"></a>
## `countAssociations([options])` -> `Promise.<Int>` ## `countAssociations([options])` -> `Promise.<Int>`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/has-many.js#L189) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/has-many.js#L189)
Count everything currently associated with this, using an optional where clause. Count everything currently associated with this, using an optional where clause.
......
<a name="hasone"></a> <a name="hasone"></a>
# Mixin HasOne # Mixin HasOne
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/has-one.js#L17) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/has-one.js#L17)
One-to-one association One-to-one association
...@@ -11,7 +11,7 @@ This is almost the same as `belongsTo` with one exception. The foreign key will ...@@ -11,7 +11,7 @@ This is almost the same as `belongsTo` with one exception. The foreign key will
<a name="getassociation"></a> <a name="getassociation"></a>
## `getAssociation([options])` -> `Promise.<Instance>` ## `getAssociation([options])` -> `Promise.<Instance>`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/has-one.js#L78) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/has-one.js#L78)
Get the associated instance. Get the associated instance.
...@@ -28,7 +28,7 @@ Get the associated instance. ...@@ -28,7 +28,7 @@ Get the associated instance.
<a name="setassociation"></a> <a name="setassociation"></a>
## `setAssociation([newAssociation], [options])` -> `Promise` ## `setAssociation([newAssociation], [options])` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/has-one.js#L87) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/has-one.js#L87)
Set the associated model. Set the associated model.
...@@ -44,7 +44,7 @@ Set the associated model. ...@@ -44,7 +44,7 @@ Set the associated model.
<a name="createassociation"></a> <a name="createassociation"></a>
## `createAssociation([values], [options])` -> `Promise` ## `createAssociation([values], [options])` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/has-one.js#L96) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/has-one.js#L96)
Create a new instance of the associated model and associate it with this. Create a new instance of the associated model and associate it with this.
......
<a name="associations"></a> <a name="associations"></a>
# Mixin Associations # Mixin Associations
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/mixin.js#L89) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/mixin.js#L89)
Creating associations in sequelize is done by calling one of the belongsTo / hasOne / hasMany / belongsToMany functions on a model (the source), and providing another model as the first argument to the function (the target). Creating associations in sequelize is done by calling one of the belongsTo / hasOne / hasMany / belongsToMany functions on a model (the source), and providing another model as the first argument to the function (the target).
...@@ -81,7 +81,7 @@ Note how we also specified `constraints: false` for profile picture. This is bec ...@@ -81,7 +81,7 @@ Note how we also specified `constraints: false` for profile picture. This is bec
<a name="hasone"></a> <a name="hasone"></a>
## `hasOne(target, [options])` ## `hasOne(target, [options])`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/mixin.js#L131) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/mixin.js#L131)
Creates an association between this (the source) and the provided target. The foreign key is added on the target. Creates an association between this (the source) and the provided target. The foreign key is added on the target.
...@@ -105,7 +105,7 @@ Example: `User.hasOne(Profile)`. This will add userId to the profile table. ...@@ -105,7 +105,7 @@ Example: `User.hasOne(Profile)`. This will add userId to the profile table.
<a name="belongsto"></a> <a name="belongsto"></a>
## `belongsTo(target, [options])` ## `belongsTo(target, [options])`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/mixin.js#L149) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/mixin.js#L149)
Creates an association between this (the source) and the provided target. The foreign key is added on the source. Creates an association between this (the source) and the provided target. The foreign key is added on the source.
...@@ -130,7 +130,7 @@ Example: `Profile.belongsTo(User)`. This will add userId to the profile table. ...@@ -130,7 +130,7 @@ Example: `Profile.belongsTo(User)`. This will add userId to the profile table.
<a name="hasmany"></a> <a name="hasmany"></a>
## `hasMany(target, [options])` ## `hasMany(target, [options])`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/mixin.js#L166) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/mixin.js#L166)
Creates a 1:m association between this (the source) and the provided target. The foreign key is added on the target. Creates a 1:m association between this (the source) and the provided target. The foreign key is added on the target.
...@@ -155,7 +155,7 @@ Example: `User.hasMany(Profile)`. This will add userId to the profile table. ...@@ -155,7 +155,7 @@ Example: `User.hasMany(Profile)`. This will add userId to the profile table.
<a name="belongstomany"></a> <a name="belongstomany"></a>
## `belongsToMany(target, [options])` ## `belongsToMany(target, [options])`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/associations/mixin.js#L245) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/associations/mixin.js#L245)
Create an N:M association with a join table. Create an N:M association with a join table.
......
<a name="deferrable"></a> <a name="deferrable"></a>
## `Deferrable()` -> `object` ## `Deferrable()` -> `object`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/deferrable.js#L39) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/deferrable.js#L39)
A collection of properties related to deferrable constraints. It can be used to A collection of properties related to deferrable constraints. It can be used to
make foreign key constraints deferrable and to set the constraints within a make foreign key constraints deferrable and to set the constraints within a
...@@ -36,7 +36,7 @@ sequelize.transaction({ ...@@ -36,7 +36,7 @@ sequelize.transaction({
<a name="initially_deferred"></a> <a name="initially_deferred"></a>
## `INITIALLY_DEFERRED()` ## `INITIALLY_DEFERRED()`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/deferrable.js#L59) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/deferrable.js#L59)
A property that will defer constraints checks to the end of transactions. A property that will defer constraints checks to the end of transactions.
...@@ -44,7 +44,7 @@ A property that will defer constraints checks to the end of transactions. ...@@ -44,7 +44,7 @@ A property that will defer constraints checks to the end of transactions.
<a name="initially_immediate"></a> <a name="initially_immediate"></a>
## `INITIALLY_IMMEDIATE()` ## `INITIALLY_IMMEDIATE()`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/deferrable.js#L76) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/deferrable.js#L76)
A property that will trigger the constraint checks immediately A property that will trigger the constraint checks immediately
...@@ -52,7 +52,7 @@ A property that will trigger the constraint checks immediately ...@@ -52,7 +52,7 @@ A property that will trigger the constraint checks immediately
<a name="not"></a> <a name="not"></a>
## `NOT()` ## `NOT()`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/deferrable.js#L95) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/deferrable.js#L95)
A property that will set the constraints to not deferred. This is A property that will set the constraints to not deferred. This is
the default in PostgreSQL and it make it impossible to dynamically the default in PostgreSQL and it make it impossible to dynamically
...@@ -62,7 +62,7 @@ defer the constraints within a transaction. ...@@ -62,7 +62,7 @@ defer the constraints within a transaction.
<a name="set_deferred"></a> <a name="set_deferred"></a>
## `SET_DEFERRED(constraints)` ## `SET_DEFERRED(constraints)`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/deferrable.js#L114) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/deferrable.js#L114)
A property that will trigger an additional query at the beginning of a A property that will trigger an additional query at the beginning of a
transaction which sets the constraints to deferred. transaction which sets the constraints to deferred.
...@@ -78,7 +78,7 @@ transaction which sets the constraints to deferred. ...@@ -78,7 +78,7 @@ transaction which sets the constraints to deferred.
<a name="set_immediate"></a> <a name="set_immediate"></a>
## `SET_IMMEDIATE(constraints)` ## `SET_IMMEDIATE(constraints)`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/deferrable.js#L135) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/deferrable.js#L135)
A property that will trigger an additional query at the beginning of a A property that will trigger an additional query at the beginning of a
transaction which sets the constraints to immediately. transaction which sets the constraints to immediately.
......
<a name="errors"></a> <a name="errors"></a>
# Class Errors # Class Errors
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L11) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L11)
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.
...@@ -9,7 +9,7 @@ All sequelize errors inherit from the base JS error object. ...@@ -9,7 +9,7 @@ All sequelize errors inherit from the base JS error object.
<a name="baseerror"></a> <a name="baseerror"></a>
## `new BaseError()` ## `new BaseError()`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L20) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L20)
The Base Error all Sequelize Errors inherit from. The Base Error all Sequelize Errors inherit from.
__Aliases:__ Error __Aliases:__ Error
...@@ -18,7 +18,7 @@ __Aliases:__ Error ...@@ -18,7 +18,7 @@ __Aliases:__ Error
<a name="validationerror"></a> <a name="validationerror"></a>
## `new ValidationError(message, [errors])` ## `new ValidationError(message, [errors])`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L41) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L41)
Validation Error. Thrown when the sequelize validation has failed. The error contains an `errors` property, Validation Error. Thrown when the sequelize validation has failed. The error contains an `errors` property,
which is an array with 1 or more ValidationErrorItems, one for each validation that failed. which is an array with 1 or more ValidationErrorItems, one for each validation that failed.
...@@ -37,7 +37,7 @@ __Extends:__ BaseError ...@@ -37,7 +37,7 @@ __Extends:__ BaseError
<a name="errors"></a> <a name="errors"></a>
## `errors` ## `errors`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L49) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L49)
An array of ValidationErrorItems An array of ValidationErrorItems
...@@ -45,7 +45,7 @@ An array of ValidationErrorItems ...@@ -45,7 +45,7 @@ An array of ValidationErrorItems
<a name="get"></a> <a name="get"></a>
## `get(path)` ## `get(path)`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L70) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L70)
Gets all validation error items for the path / field specified. Gets all validation error items for the path / field specified.
...@@ -60,7 +60,7 @@ Gets all validation error items for the path / field specified. ...@@ -60,7 +60,7 @@ Gets all validation error items for the path / field specified.
<a name="databaseerror"></a> <a name="databaseerror"></a>
## `new DatabaseError()` ## `new DatabaseError()`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L84) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L84)
A base class for all database related errors. A base class for all database related errors.
...@@ -70,7 +70,7 @@ __Extends:__ BaseError ...@@ -70,7 +70,7 @@ __Extends:__ BaseError
<a name="parent"></a> <a name="parent"></a>
## `parent` ## `parent`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L92) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L92)
The database specific error which triggered this one The database specific error which triggered this one
...@@ -78,7 +78,7 @@ The database specific error which triggered this one ...@@ -78,7 +78,7 @@ The database specific error which triggered this one
<a name="sql"></a> <a name="sql"></a>
## `sql` ## `sql`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L98) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L98)
The SQL that triggered the error The SQL that triggered the error
...@@ -86,7 +86,7 @@ The SQL that triggered the error ...@@ -86,7 +86,7 @@ The SQL that triggered the error
<a name="message"></a> <a name="message"></a>
## `message()` ## `message()`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L104) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L104)
The message from the DB. The message from the DB.
...@@ -94,7 +94,7 @@ The message from the DB. ...@@ -94,7 +94,7 @@ The message from the DB.
<a name="fields"></a> <a name="fields"></a>
## `fields()` ## `fields()`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L109) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L109)
The fields of the unique constraint The fields of the unique constraint
...@@ -102,7 +102,7 @@ The fields of the unique constraint ...@@ -102,7 +102,7 @@ The fields of the unique constraint
<a name="value"></a> <a name="value"></a>
## `value()` ## `value()`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L114) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L114)
The value(s) which triggered the error The value(s) which triggered the error
...@@ -110,7 +110,7 @@ The value(s) which triggered the error ...@@ -110,7 +110,7 @@ The value(s) which triggered the error
<a name="index"></a> <a name="index"></a>
## `index()` ## `index()`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L119) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L119)
The name of the index that triggered the error The name of the index that triggered the error
...@@ -118,7 +118,7 @@ The name of the index that triggered the error ...@@ -118,7 +118,7 @@ The name of the index that triggered the error
<a name="timeouterror"></a> <a name="timeouterror"></a>
## `new TimeoutError()` ## `new TimeoutError()`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L127) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L127)
Thrown when a database query times out because of a deadlock Thrown when a database query times out because of a deadlock
...@@ -128,7 +128,7 @@ __Extends:__ DatabaseError ...@@ -128,7 +128,7 @@ __Extends:__ DatabaseError
<a name="uniqueconstrainterror"></a> <a name="uniqueconstrainterror"></a>
## `new UniqueConstraintError()` ## `new UniqueConstraintError()`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L138) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L138)
Thrown when a unique constraint is violated in the database Thrown when a unique constraint is violated in the database
...@@ -138,7 +138,7 @@ __Extends:__ DatabaseError ...@@ -138,7 +138,7 @@ __Extends:__ DatabaseError
<a name="foreignkeyconstrainterror"></a> <a name="foreignkeyconstrainterror"></a>
## `new ForeignKeyConstraintError()` ## `new ForeignKeyConstraintError()`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L157) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L157)
Thrown when a foreign key constraint is violated in the database Thrown when a foreign key constraint is violated in the database
...@@ -148,7 +148,7 @@ __Extends:__ DatabaseError ...@@ -148,7 +148,7 @@ __Extends:__ DatabaseError
<a name="exclusionconstrainterror"></a> <a name="exclusionconstrainterror"></a>
## `new ExclusionConstraintError()` ## `new ExclusionConstraintError()`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L177) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L177)
Thrown when an exclusion constraint is violated in the database Thrown when an exclusion constraint is violated in the database
...@@ -158,7 +158,7 @@ __Extends:__ DatabaseError ...@@ -158,7 +158,7 @@ __Extends:__ DatabaseError
<a name="validationerroritem"></a> <a name="validationerroritem"></a>
## `new ValidationErrorItem(message, type, path, value)` ## `new ValidationErrorItem(message, type, path, value)`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L201) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L201)
Validation Error Item Validation Error Item
Instances of this class are included in the `ValidationError.errors` property. Instances of this class are included in the `ValidationError.errors` property.
...@@ -177,7 +177,7 @@ Instances of this class are included in the `ValidationError.errors` property. ...@@ -177,7 +177,7 @@ Instances of this class are included in the `ValidationError.errors` property.
<a name="connectionerror"></a> <a name="connectionerror"></a>
## `new ConnectionError()` ## `new ConnectionError()`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L213) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L213)
A base class for all connection related errors. A base class for all connection related errors.
...@@ -187,7 +187,7 @@ __Extends:__ BaseError ...@@ -187,7 +187,7 @@ __Extends:__ BaseError
<a name="parent"></a> <a name="parent"></a>
## `parent` ## `parent`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L220) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L220)
The connection specific error which triggered this one The connection specific error which triggered this one
...@@ -195,7 +195,7 @@ The connection specific error which triggered this one ...@@ -195,7 +195,7 @@ The connection specific error which triggered this one
<a name="connectionrefusederror"></a> <a name="connectionrefusederror"></a>
## `new ConnectionRefusedError()` ## `new ConnectionRefusedError()`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L230) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L230)
Thrown when a connection to a database is refused Thrown when a connection to a database is refused
...@@ -205,7 +205,7 @@ __Extends:__ ConnectionError ...@@ -205,7 +205,7 @@ __Extends:__ ConnectionError
<a name="accessdeniederror"></a> <a name="accessdeniederror"></a>
## `new AccessDeniedError()` ## `new AccessDeniedError()`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L241) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L241)
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
...@@ -215,7 +215,7 @@ __Extends:__ ConnectionError ...@@ -215,7 +215,7 @@ __Extends:__ ConnectionError
<a name="hostnotfounderror"></a> <a name="hostnotfounderror"></a>
## `new HostNotFoundError()` ## `new HostNotFoundError()`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L252) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L252)
Thrown when a connection to a database has a hostname that was not found Thrown when a connection to a database has a hostname that was not found
...@@ -225,7 +225,7 @@ __Extends:__ ConnectionError ...@@ -225,7 +225,7 @@ __Extends:__ ConnectionError
<a name="hostnotreachableerror"></a> <a name="hostnotreachableerror"></a>
## `new HostNotReachableError()` ## `new HostNotReachableError()`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L263) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L263)
Thrown when a connection to a database has a hostname that was not reachable Thrown when a connection to a database has a hostname that was not reachable
...@@ -235,7 +235,7 @@ __Extends:__ ConnectionError ...@@ -235,7 +235,7 @@ __Extends:__ ConnectionError
<a name="invalidconnectionerror"></a> <a name="invalidconnectionerror"></a>
## `new InvalidConnectionError()` ## `new InvalidConnectionError()`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L274) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L274)
Thrown when a connection to a database has invalid values for any of the connection parameters Thrown when a connection to a database has invalid values for any of the connection parameters
...@@ -245,7 +245,7 @@ __Extends:__ ConnectionError ...@@ -245,7 +245,7 @@ __Extends:__ ConnectionError
<a name="connectiontimedouterror"></a> <a name="connectiontimedouterror"></a>
## `new ConnectionTimedOutError()` ## `new ConnectionTimedOutError()`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L285) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L285)
Thrown when a connection to a database times out Thrown when a connection to a database times out
...@@ -255,7 +255,7 @@ __Extends:__ ConnectionError ...@@ -255,7 +255,7 @@ __Extends:__ ConnectionError
<a name="instanceerror"></a> <a name="instanceerror"></a>
## `new InstanceError()` ## `new InstanceError()`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/errors.js#L296) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/errors.js#L296)
Thrown when a some problem occurred with Instance methods (see message for details) Thrown when a some problem occurred with Instance methods (see message for details)
......
<a name="instance"></a> <a name="instance"></a>
# Class Instance # Class Instance
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/instance.js#L85) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/instance.js#L85)
This class represents an single instance, a database row. You might see it referred to as both Instance and instance. You should not This class represents an single instance, a database row. You might see it referred to as both Instance and instance. You should not
instantiate the Instance class directly, instead you access it using the finder and creation methods on the model. instantiate the Instance class directly, instead you access it using the finder and creation methods on the model.
...@@ -26,7 +26,7 @@ Accessing properties directly or using `get` is preferred for regular use, `getD ...@@ -26,7 +26,7 @@ Accessing properties directly or using `get` is preferred for regular use, `getD
<a name="isnewrecord"></a> <a name="isnewrecord"></a>
## `isNewRecord` -> `Boolean` ## `isNewRecord` -> `Boolean`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/instance.js#L98) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/instance.js#L98)
Returns true if this instance has not yet been persisted to the database Returns true if this instance has not yet been persisted to the database
...@@ -34,7 +34,7 @@ Returns true if this instance has not yet been persisted to the database ...@@ -34,7 +34,7 @@ Returns true if this instance has not yet been persisted to the database
<a name="model"></a> <a name="model"></a>
## `Model()` -> `Model` ## `Model()` -> `Model`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/instance.js#L107) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/instance.js#L107)
Returns the Model the instance was created from. Returns the Model the instance was created from.
...@@ -47,7 +47,7 @@ Returns the Model the instance was created from. ...@@ -47,7 +47,7 @@ Returns the Model the instance was created from.
<a name="sequelize"></a> <a name="sequelize"></a>
## `sequelize()` -> `Sequelize` ## `sequelize()` -> `Sequelize`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/instance.js#L116) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/instance.js#L116)
A reference to the sequelize instance A reference to the sequelize instance
...@@ -60,7 +60,7 @@ A reference to the sequelize instance ...@@ -60,7 +60,7 @@ A reference to the sequelize instance
<a name="where"></a> <a name="where"></a>
## `where()` -> `Object` ## `where()` -> `Object`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/instance.js#L126) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/instance.js#L126)
Get an object representing the query for this instance, use with `options.where` Get an object representing the query for this instance, use with `options.where`
...@@ -68,7 +68,7 @@ Get an object representing the query for this instance, use with `options.where` ...@@ -68,7 +68,7 @@ Get an object representing the query for this instance, use with `options.where`
<a name="getdatavalue"></a> <a name="getdatavalue"></a>
## `getDataValue(key)` -> `any` ## `getDataValue(key)` -> `any`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/instance.js#L150) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/instance.js#L150)
Get the value of the underlying data value Get the value of the underlying data value
...@@ -83,7 +83,7 @@ Get the value of the underlying data value ...@@ -83,7 +83,7 @@ Get the value of the underlying data value
<a name="setdatavalue"></a> <a name="setdatavalue"></a>
## `setDataValue(key, value)` ## `setDataValue(key, value)`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/instance.js#L160) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/instance.js#L160)
Update the underlying data value Update the underlying data value
...@@ -99,7 +99,7 @@ Update the underlying data value ...@@ -99,7 +99,7 @@ Update the underlying data value
<a name="get"></a> <a name="get"></a>
## `get([key], [options])` -> `Object|any` ## `get([key], [options])` -> `Object|any`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/instance.js#L179) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/instance.js#L179)
If no key is given, returns all values of the instance, also invoking virtual getters. If no key is given, returns all values of the instance, also invoking virtual getters.
...@@ -118,7 +118,7 @@ If key is given and a field or virtual getter is present for the key it will cal ...@@ -118,7 +118,7 @@ If key is given and a field or virtual getter is present for the key it will cal
<a name="set"></a> <a name="set"></a>
## `set(key, value, [options])` ## `set(key, value, [options])`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/instance.js#L249) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/instance.js#L249)
Set is used to update values on the instance (the sequelize representation of the instance that is, remember that nothing will be persisted before you actually call `save`). Set is used to update values on the instance (the sequelize representation of the instance that is, remember that nothing will be persisted before you actually call `save`).
In its most basic form `set` will update a value stored in the underlying `dataValues` object. However, if a custom setter function is defined for the key, that function In its most basic form `set` will update a value stored in the underlying `dataValues` object. However, if a custom setter function is defined for the key, that function
...@@ -156,7 +156,7 @@ __Aliases:__ setAttributes ...@@ -156,7 +156,7 @@ __Aliases:__ setAttributes
<a name="changed"></a> <a name="changed"></a>
## `changed([key])` -> `Boolean|Array` ## `changed([key])` -> `Boolean|Array`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/instance.js#L401) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/instance.js#L401)
If changed is called with a string it will return a boolean indicating whether the value of that key in `dataValues` is different from the value in `_previousDataValues`. If changed is called with a string it will return a boolean indicating whether the value of that key in `dataValues` is different from the value in `_previousDataValues`.
...@@ -175,7 +175,7 @@ If changed is called without an argument and no keys have changed, it will retur ...@@ -175,7 +175,7 @@ If changed is called without an argument and no keys have changed, it will retur
<a name="previous"></a> <a name="previous"></a>
## `previous([key])` -> `any|Array.<any>` ## `previous([key])` -> `any|Array.<any>`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/instance.js#L425) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/instance.js#L425)
Returns the previous value for key from `_previousDataValues`. Returns the previous value for key from `_previousDataValues`.
...@@ -192,7 +192,7 @@ If called without a key, returns the previous values for all values which have c ...@@ -192,7 +192,7 @@ If called without a key, returns the previous values for all values which have c
<a name="save"></a> <a name="save"></a>
## `save([options])` -> `Promise.<this|Errors.ValidationError>` ## `save([options])` -> `Promise.<this|Errors.ValidationError>`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/instance.js#L493) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/instance.js#L493)
Validate this instance, and if the validation passes, persist it to the database. It will only save changed fields, and do nothing if no fields have changed. Validate this instance, and if the validation passes, persist it to the database. It will only save changed fields, and do nothing if no fields have changed.
...@@ -216,7 +216,7 @@ This error will have a property for each of the fields for which validation fail ...@@ -216,7 +216,7 @@ This error will have a property for each of the fields for which validation fail
<a name="reload"></a> <a name="reload"></a>
## `reload([options])` -> `Promise.<this>` ## `reload([options])` -> `Promise.<this>`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/instance.js#L740) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/instance.js#L740)
Refresh the current instance in-place, i.e. update the object with current data from the DB and return the same object. Refresh the current instance in-place, i.e. update the object with current data from the DB and return the same object.
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,
...@@ -239,7 +239,7 @@ all references to the Instance are updated with the new data and no new objects ...@@ -239,7 +239,7 @@ all references to the Instance are updated with the new data and no new objects
<a name="validate"></a> <a name="validate"></a>
## `validate([options])` -> `Promise.<Errors.ValidationError|undefined>` ## `validate([options])` -> `Promise.<Errors.ValidationError|undefined>`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/instance.js#L776) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/instance.js#L776)
Validate the attribute of this instance according to validation rules set in the model definition. Validate the attribute of this instance according to validation rules set in the model definition.
...@@ -262,7 +262,7 @@ Emits null if and only if validation successful; otherwise an Error instance con ...@@ -262,7 +262,7 @@ Emits null if and only if validation successful; otherwise an Error instance con
<a name="update"></a> <a name="update"></a>
## `update(updates, options)` -> `Promise.<this>` ## `update(updates, options)` -> `Promise.<this>`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/instance.js#L796) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/instance.js#L796)
This is the same as calling `set` and then calling `save` but it only saves the This is the same as calling `set` and then calling `save` but it only saves the
exact values passed to it, making it more atomic and safer. exact values passed to it, making it more atomic and safer.
...@@ -286,7 +286,7 @@ __Aliases:__ updateAttributes ...@@ -286,7 +286,7 @@ __Aliases:__ updateAttributes
<a name="destroy"></a> <a name="destroy"></a>
## `destroy([options={}])` -> `Promise.<undefined>` ## `destroy([options={}])` -> `Promise.<undefined>`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/instance.js#L835) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/instance.js#L835)
Destroy the row corresponding to this instance. Depending on your setting for paranoid, the row will either be completely deleted, or have its deletedAt timestamp set to the current time. Destroy the row corresponding to this instance. Depending on your setting for paranoid, the row will either be completely deleted, or have its deletedAt timestamp set to the current time.
...@@ -305,7 +305,7 @@ Destroy the row corresponding to this instance. Depending on your setting for pa ...@@ -305,7 +305,7 @@ Destroy the row corresponding to this instance. Depending on your setting for pa
<a name="restore"></a> <a name="restore"></a>
## `restore([options={}])` -> `Promise.<undefined>` ## `restore([options={}])` -> `Promise.<undefined>`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/instance.js#L882) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/instance.js#L882)
Restore the row corresponding to this instance. Only available for paranoid models. Restore the row corresponding to this instance. Only available for paranoid models.
...@@ -322,7 +322,7 @@ Restore the row corresponding to this instance. Only available for paranoid mode ...@@ -322,7 +322,7 @@ Restore the row corresponding to this instance. Only available for paranoid mode
<a name="increment"></a> <a name="increment"></a>
## `increment(fields, [options])` -> `Promise.<this>` ## `increment(fields, [options])` -> `Promise.<this>`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/instance.js#L934) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/instance.js#L934)
Increment the value of one or more columns. This is done in the database, which means it does not use the values currently stored on the Instance. The increment is done using a Increment the value of one or more columns. This is done in the database, which means it does not use the values currently stored on the Instance. The increment is done using a
```sql ```sql
...@@ -358,7 +358,7 @@ instance.increment({ answer: 42, tries: 1}, { by: 2 }) // increment answer by 42 ...@@ -358,7 +358,7 @@ instance.increment({ answer: 42, tries: 1}, { by: 2 }) // increment answer by 42
<a name="decrement"></a> <a name="decrement"></a>
## `decrement(fields, [options])` -> `Promise` ## `decrement(fields, [options])` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/instance.js#L997) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/instance.js#L997)
Decrement the value of one or more columns. This is done in the database, which means it does not use the values currently stored on the Instance. The decrement is done using a Decrement the value of one or more columns. This is done in the database, which means it does not use the values currently stored on the Instance. The decrement is done using a
```sql ```sql
...@@ -394,7 +394,7 @@ instance.decrement({ answer: 42, tries: 1}, { by: 2 }) // decrement answer by 42 ...@@ -394,7 +394,7 @@ instance.decrement({ answer: 42, tries: 1}, { by: 2 }) // decrement answer by 42
<a name="equals"></a> <a name="equals"></a>
## `equals(other)` -> `Boolean` ## `equals(other)` -> `Boolean`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/instance.js#L1019) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/instance.js#L1019)
Check whether all values of this and `other` Instance are the same Check whether all values of this and `other` Instance are the same
...@@ -409,7 +409,7 @@ Check whether all values of this and `other` Instance are the same ...@@ -409,7 +409,7 @@ Check whether all values of this and `other` Instance are the same
<a name="equalsoneof"></a> <a name="equalsoneof"></a>
## `equalsOneOf(others)` -> `Boolean` ## `equalsOneOf(others)` -> `Boolean`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/instance.js#L1043) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/instance.js#L1043)
Check if this is equal to one of `others` by calling equals Check if this is equal to one of `others` by calling equals
...@@ -424,7 +424,7 @@ Check if this is equal to one of `others` by calling equals ...@@ -424,7 +424,7 @@ Check if this is equal to one of `others` by calling equals
<a name="tojson"></a> <a name="tojson"></a>
## `toJSON()` -> `object` ## `toJSON()` -> `object`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/instance.js#L1061) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/instance.js#L1061)
Convert the instance to a JSON representation. Proxies to calling `get` with no keys. This means get all values gotten from the DB, and apply all custom getters. Convert the instance to a JSON representation. Proxies to calling `get` with no keys. This means get all values gotten from the DB, and apply all custom getters.
......
<a name="transaction"></a> <a name="transaction"></a>
# Class Transaction # Class Transaction
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/transaction.js#L20) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/transaction.js#L20)
The transaction object is used to identify a running transaction. It is created by calling `Sequelize.transaction()`. The transaction object is used to identify a running transaction. It is created by calling `Sequelize.transaction()`.
...@@ -22,7 +22,7 @@ To run a query under a transaction, you should pass the transaction in the optio ...@@ -22,7 +22,7 @@ To run a query under a transaction, you should pass the transaction in the optio
<a name="types"></a> <a name="types"></a>
## `TYPES` ## `TYPES`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/transaction.js#L76) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/transaction.js#L76)
Types can be set per-transaction by passing `options.type` to `sequelize.transaction`. Types can be set per-transaction by passing `options.type` to `sequelize.transaction`.
Default to `DEFERRED` but you can override the default type by passing `options.transactionType` in `new Sequelize`. Default to `DEFERRED` but you can override the default type by passing `options.transactionType` in `new Sequelize`.
...@@ -58,7 +58,7 @@ return sequelize.transaction({ ...@@ -58,7 +58,7 @@ return sequelize.transaction({
<a name="isolation_levels"></a> <a name="isolation_levels"></a>
## `ISOLATION_LEVELS` ## `ISOLATION_LEVELS`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/transaction.js#L116) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/transaction.js#L116)
Isolations levels can be set per-transaction by passing `options.isolationLevel` to `sequelize.transaction`. Isolations levels can be set per-transaction by passing `options.isolationLevel` to `sequelize.transaction`.
Default to `REPEATABLE_READ` but you can override the default isolation level by passing `options.isolationLevel` in `new Sequelize`. Default to `REPEATABLE_READ` but you can override the default isolation level by passing `options.isolationLevel` in `new Sequelize`.
...@@ -94,7 +94,7 @@ return sequelize.transaction({ ...@@ -94,7 +94,7 @@ return sequelize.transaction({
<a name="lock"></a> <a name="lock"></a>
## `LOCK` ## `LOCK`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/transaction.js#L160) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/transaction.js#L160)
Possible options for row locking. Used in conjunction with `find` calls: Possible options for row locking. Used in conjunction with `find` calls:
...@@ -134,7 +134,7 @@ UserModel will be locked but TaskModel won't! ...@@ -134,7 +134,7 @@ UserModel will be locked but TaskModel won't!
<a name="commit"></a> <a name="commit"></a>
## `commit()` -> `Promise` ## `commit()` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/transaction.js#L172) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/transaction.js#L172)
Commit the transaction Commit the transaction
...@@ -142,7 +142,7 @@ Commit the transaction ...@@ -142,7 +142,7 @@ Commit the transaction
<a name="rollback"></a> <a name="rollback"></a>
## `rollback()` -> `Promise` ## `rollback()` -> `Promise`
[View code](https://github.com/sequelize/sequelize/blob/d10eee53d37abb67db47160f067ac3cdc7e1bf43/lib/transaction.js#L200) [View code](https://github.com/sequelize/sequelize/blob/3e5b8772ef75169685fc96024366bca9958fee63/lib/transaction.js#L200)
Rollback (abort) the transaction Rollback (abort) the transaction
......
...@@ -126,6 +126,10 @@ Sequelize.RANGE(Sequelize.DATEONLY) // Defines daterange range. PostgreSQL onl ...@@ -126,6 +126,10 @@ Sequelize.RANGE(Sequelize.DATEONLY) // Defines daterange range. PostgreSQL onl
Sequelize.RANGE(Sequelize.DECIMAL) // Defines numrange range. PostgreSQL only. Sequelize.RANGE(Sequelize.DECIMAL) // Defines numrange range. PostgreSQL only.
Sequelize.ARRAY(Sequelize.RANGE(Sequelize.DATE)) // Defines array of tstzrange ranges. PostgreSQL only. Sequelize.ARRAY(Sequelize.RANGE(Sequelize.DATE)) // Defines array of tstzrange ranges. PostgreSQL only.
Sequelize.GEOMETRY // Spatial column. PostgreSQL (with PostGIS) or MySQL only.
Sequelize.GEOMETRY('POINT') // Spatial column with geomerty type. PostgreSQL (with PostGIS) or MySQL only.
Sequelize.GEOMETRY('POINT', 4326) // Spatial column with geomerty type and SRID. PostgreSQL (with PostGIS) or MySQL only.
``` ```
The BLOB data type allows you to insert data both as strings and as buffers. When you do a find or findAll on a model which has a BLOB column. that data will always be returned as a buffer. The BLOB data type allows you to insert data both as strings and as buffers. When you do a find or findAll on a model which has a BLOB column. that data will always be returned as a buffer.
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!