UNPKG

sequelize

Version:

Multi dialect ORM for Node.JS/io.js

1,962 lines 928 kB
[ { "__docId__": 0, "kind": "file", "name": "lib/associations/base.js", "content": "", "static": true, "longname": "lib/associations/base.js", "access": null, "description": null, "lineNumber": 1 }, { "__docId__": 1, "kind": "variable", "name": "AssociationError", "memberof": "lib/associations/base.js", "static": true, "longname": "lib/associations/base.js~AssociationError", "access": null, "export": false, "importPath": "sequelize/lib/associations/base.js", "importStyle": null, "description": null, "lineNumber": 2, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 2, "kind": "class", "name": "Association", "memberof": "lib/associations/base.js", "static": true, "longname": "lib/associations/base.js~Association", "access": null, "export": false, "importPath": "sequelize/lib/associations/base.js", "importStyle": null, "description": "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).\n\n* hasOne - adds a foreign key to the target and singular association mixins to the source.\n* belongsTo - add a foreign key and singular association mixins to the source.\n* hasMany - adds a foreign key to target and plural association mixins to the source.\n* belongsToMany - creates an N:M association with a join table and adds plural association mixins to the source. The junction table is created with sourceId and targetId.\n\nCreating an association will add a foreign key constraint to the attributes. All associations use `CASCADE` on update and `SET NULL` on delete, except for n:m, which also uses `CASCADE` on delete.\n\nWhen creating associations, you can provide an alias, via the `as` option. This is useful if the same model is associated twice, or you want your association to be called something other than the name of the target model.\n\nAs an example, consider the case where users have many pictures, one of which is their profile picture. All pictures have a `userId`, but in addition the user model also has a `profilePictureId`, to be able to easily load the user's profile picture.\n\n```js\nUser.hasMany(Picture)\nUser.belongsTo(Picture, { as: 'ProfilePicture', constraints: false })\n\nuser.getPictures() // gets you all pictures\nuser.getProfilePicture() // gets you only the profile picture\n\nUser.findAll({\n where: ...,\n include: [\n { model: Picture }, // load all pictures\n { model: Picture, as: 'ProfilePicture' }, // load the profile picture.\n // Notice that the spelling must be the exact same as the one in the association\n ]\n})\n```\nTo get full control over the foreign key column added by sequelize, you can use the `foreignKey` option. It can either be a string, that specifies the name, or and object type definition,\nequivalent to those passed to `sequelize.define`.\n\n```js\nUser.hasMany(Picture, { foreignKey: 'uid' })\n```\n\nThe foreign key column in Picture will now be called `uid` instead of the default `userId`.\n\n```js\nUser.hasMany(Picture, {\n foreignKey: {\n name: 'uid',\n allowNull: false\n }\n})\n```\n\nThis specifies that the `uid` column cannot be null. In most cases this will already be covered by the foreign key constraints, which sequelize creates automatically, but can be useful in case where the foreign keys are disabled, e.g. due to circular references (see `constraints: false` below).\n\nWhen fetching associated models, you can limit your query to only load some models. These queries are written in the same way as queries to `find`/`findAll`. To only get pictures in JPG, you can do:\n\n```js\nuser.getPictures({\n where: {\n format: 'jpg'\n }\n})\n```\n\nThere are several ways to update and add new associations. Continuing with our example of users and pictures:\n```js\nuser.addPicture(p) // Add a single picture\nuser.setPictures([p1, p2]) // Associate user with ONLY these two picture, all other associations will be deleted\nuser.addPictures([p1, p2]) // Associate user with these two pictures, but don't touch any current associations\n```\n\nYou don't have to pass in a complete object to the association functions, if your associated model has a single primary key:\n\n```js\nuser.addPicture(req.query.pid) // Here pid is just an integer, representing the primary key of the picture\n```\n\nIn the example above we have specified that a user belongs to his profile picture. Conceptually, this might not make sense, but since we want to add the foreign key to the user model this is the way to do it.\n\nNote how we also specified `constraints: false` for profile picture. This is because we add a foreign key from user to picture (profilePictureId), and from picture to user (userId). If we were to add foreign keys to both, it would create a cyclic dependency, and sequelize would not know which table to create first, since user depends on picture, and picture depends on user. These kinds of problems are detected by sequelize before the models are synced to the database, and you will get an error along the lines of `Error: Cyclic dependency found. 'users' is dependent of itself`. If you encounter this, you should either disable some constraints, or rethink your associations completely.", "lineNumber": 82, "interface": false }, { "__docId__": 3, "kind": "constructor", "name": "constructor", "memberof": "lib/associations/base.js~Association", "generator": false, "async": false, "static": false, "longname": "lib/associations/base.js~Association#constructor", "access": null, "description": null, "lineNumber": 83, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "params": [ { "name": "source", "types": [ "*" ] }, { "name": "target", "types": [ "*" ] }, { "name": "options", "types": [ "*" ] } ] }, { "__docId__": 4, "kind": "member", "name": "source", "memberof": "lib/associations/base.js~Association", "static": false, "longname": "lib/associations/base.js~Association#source", "access": null, "description": "", "lineNumber": 88, "type": { "nullable": null, "types": [ "Model" ], "spread": false, "description": null } }, { "__docId__": 5, "kind": "member", "name": "target", "memberof": "lib/associations/base.js~Association", "static": false, "longname": "lib/associations/base.js~Association#target", "access": null, "description": "", "lineNumber": 92, "type": { "nullable": null, "types": [ "Model" ], "spread": false, "description": null } }, { "__docId__": 6, "kind": "member", "name": "options", "memberof": "lib/associations/base.js~Association", "static": false, "longname": "lib/associations/base.js~Association#options", "access": null, "description": null, "lineNumber": 93, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 7, "kind": "member", "name": "scope", "memberof": "lib/associations/base.js~Association", "static": false, "longname": "lib/associations/base.js~Association#scope", "access": null, "description": null, "lineNumber": 94, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 8, "kind": "member", "name": "isSelfAssociation", "memberof": "lib/associations/base.js~Association", "static": false, "longname": "lib/associations/base.js~Association#isSelfAssociation", "access": null, "description": null, "lineNumber": 95, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 9, "kind": "member", "name": "as", "memberof": "lib/associations/base.js~Association", "static": false, "longname": "lib/associations/base.js~Association#as", "access": null, "description": null, "lineNumber": 96, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 10, "kind": "member", "name": "associationType", "memberof": "lib/associations/base.js~Association", "static": false, "longname": "lib/associations/base.js~Association#associationType", "access": null, "description": "The type of the association. One of `HasMany`, `BelongsTo`, `HasOne`, `BelongsToMany`", "lineNumber": 101, "type": { "nullable": null, "types": [ "string" ], "spread": false, "description": null } }, { "__docId__": 11, "kind": "method", "name": "toInstanceArray", "memberof": "lib/associations/base.js~Association", "generator": false, "async": false, "static": false, "longname": "lib/associations/base.js~Association#toInstanceArray", "access": null, "description": null, "lineNumber": 110, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "params": [ { "name": "objs", "types": [ "*" ] } ], "return": { "types": [ "*" ] } }, { "__docId__": 12, "kind": "method", "name": "inspect", "memberof": "lib/associations/base.js~Association", "generator": false, "async": false, "static": false, "longname": "lib/associations/base.js~Association#inspect", "access": null, "description": null, "lineNumber": 125, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "params": [], "return": { "types": [ "*" ] } }, { "__docId__": 13, "kind": "file", "name": "lib/associations/belongs-to-many.js", "content": "", "static": true, "longname": "lib/associations/belongs-to-many.js", "access": null, "description": null, "lineNumber": 1 }, { "__docId__": 14, "kind": "variable", "name": "Utils", "memberof": "lib/associations/belongs-to-many.js", "static": true, "longname": "lib/associations/belongs-to-many.js~Utils", "access": null, "export": false, "importPath": "sequelize/lib/associations/belongs-to-many.js", "importStyle": null, "description": null, "lineNumber": 3, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 15, "kind": "variable", "name": "Helpers", "memberof": "lib/associations/belongs-to-many.js", "static": true, "longname": "lib/associations/belongs-to-many.js~Helpers", "access": null, "export": false, "importPath": "sequelize/lib/associations/belongs-to-many.js", "importStyle": null, "description": null, "lineNumber": 4, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 16, "kind": "variable", "name": "_", "memberof": "lib/associations/belongs-to-many.js", "static": true, "longname": "lib/associations/belongs-to-many.js~_", "access": null, "export": false, "importPath": "sequelize/lib/associations/belongs-to-many.js", "importStyle": null, "description": null, "lineNumber": 5, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 17, "kind": "variable", "name": "Association", "memberof": "lib/associations/belongs-to-many.js", "static": true, "longname": "lib/associations/belongs-to-many.js~Association", "access": null, "export": false, "importPath": "sequelize/lib/associations/belongs-to-many.js", "importStyle": null, "description": null, "lineNumber": 6, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 18, "kind": "variable", "name": "BelongsTo", "memberof": "lib/associations/belongs-to-many.js", "static": true, "longname": "lib/associations/belongs-to-many.js~BelongsTo", "access": null, "export": false, "importPath": "sequelize/lib/associations/belongs-to-many.js", "importStyle": null, "description": null, "lineNumber": 7, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 19, "kind": "variable", "name": "HasMany", "memberof": "lib/associations/belongs-to-many.js", "static": true, "longname": "lib/associations/belongs-to-many.js~HasMany", "access": null, "export": false, "importPath": "sequelize/lib/associations/belongs-to-many.js", "importStyle": null, "description": null, "lineNumber": 8, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 20, "kind": "variable", "name": "HasOne", "memberof": "lib/associations/belongs-to-many.js", "static": true, "longname": "lib/associations/belongs-to-many.js~HasOne", "access": null, "export": false, "importPath": "sequelize/lib/associations/belongs-to-many.js", "importStyle": null, "description": null, "lineNumber": 9, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 21, "kind": "variable", "name": "AssociationError", "memberof": "lib/associations/belongs-to-many.js", "static": true, "longname": "lib/associations/belongs-to-many.js~AssociationError", "access": null, "export": false, "importPath": "sequelize/lib/associations/belongs-to-many.js", "importStyle": null, "description": null, "lineNumber": 10, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 22, "kind": "class", "name": "BelongsToMany", "memberof": "lib/associations/belongs-to-many.js", "static": true, "longname": "lib/associations/belongs-to-many.js~BelongsToMany", "access": null, "export": false, "importPath": "sequelize/lib/associations/belongs-to-many.js", "importStyle": null, "description": "Many-to-many association with a join table.\n\nWhen the join table has additional attributes, these can be passed in the options object:\n\n```js\nUserProject = sequelize.define('user_project', {\n role: Sequelize.STRING\n});\nUser.belongsToMany(Project, { through: UserProject });\nProject.belongsToMany(User, { through: UserProject });\n// through is required!\n\nuser.addProject(project, { through: { role: 'manager' }});\n```\n\nAll methods allow you to pass either a persisted instance, its primary key, or a mixture:\n\n```js\nProject.create({ id: 11 }).then(function (project) {\n user.addProjects([project, 12]);\n});\n```\n\nIf you want to set several target instances, but with different attributes you have to set the attributes on the instance, using a property with the name of the through model:\n\n```js\np1.UserProjects = {\n started: true\n}\nuser.setProjects([p1, p2], { through: { started: false }}) // The default value is false, but p1 overrides that.\n```\n\nSimilarly, when fetching through a join table with custom attributes, these attributes will be available as an object with the name of the through model.\n```js\nuser.getProjects().then(function (projects) {\n let p1 = projects[0]\n p1.UserProjects.started // Is this project started yet?\n})\n```\n\nIn the API reference below, add the name of the association to the method, e.g. for `User.belongsToMany(Project)` the getter will be `user.getProjects()`.", "see": [ "{@link Model.belongsToMany}" ], "lineNumber": 57, "interface": false, "extends": [ "Association" ] }, { "__docId__": 23, "kind": "constructor", "name": "constructor", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "generator": false, "async": false, "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#constructor", "access": null, "description": null, "lineNumber": 58, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "params": [ { "name": "source", "types": [ "*" ] }, { "name": "target", "types": [ "*" ] }, { "name": "options", "types": [ "*" ] } ] }, { "__docId__": 24, "kind": "member", "name": "associationType", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#associationType", "access": null, "description": null, "lineNumber": 71, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "string" ] } }, { "__docId__": 25, "kind": "member", "name": "targetAssociation", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#targetAssociation", "access": null, "description": null, "lineNumber": 72, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 26, "kind": "member", "name": "sequelize", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#sequelize", "access": null, "description": null, "lineNumber": 73, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 27, "kind": "member", "name": "through", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#through", "access": null, "description": null, "lineNumber": 74, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 28, "kind": "member", "name": "isMultiAssociation", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#isMultiAssociation", "access": null, "description": null, "lineNumber": 75, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "boolean" ] } }, { "__docId__": 29, "kind": "member", "name": "doubleLinked", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#doubleLinked", "access": null, "description": null, "lineNumber": 76, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "boolean" ] } }, { "__docId__": 30, "kind": "member", "name": "isAliased", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#isAliased", "access": null, "description": null, "lineNumber": 83, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "boolean" ] } }, { "__docId__": 31, "kind": "member", "name": "as", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#as", "access": null, "description": null, "lineNumber": 87, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 32, "kind": "member", "name": "as", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#as", "access": null, "description": null, "lineNumber": 95, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 33, "kind": "member", "name": "combinedTableName", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#combinedTableName", "access": null, "description": null, "lineNumber": 99, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 34, "kind": "member", "name": "targetAssociation", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#targetAssociation", "access": null, "description": null, "lineNumber": 108, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 35, "kind": "member", "name": "foreignKeyAttribute", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#foreignKeyAttribute", "access": null, "description": null, "lineNumber": 115, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 36, "kind": "member", "name": "foreignKey", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#foreignKey", "access": null, "description": null, "lineNumber": 116, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 37, "kind": "member", "name": "foreignKeyDefault", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#foreignKeyDefault", "access": null, "description": null, "lineNumber": 119, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "boolean" ] } }, { "__docId__": 38, "kind": "member", "name": "foreignKeyAttribute", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#foreignKeyAttribute", "access": null, "description": null, "lineNumber": 122, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "{}" ] } }, { "__docId__": 39, "kind": "member", "name": "foreignKey", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#foreignKey", "access": null, "description": null, "lineNumber": 123, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 40, "kind": "member", "name": "otherKeyAttribute", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#otherKeyAttribute", "access": null, "description": null, "lineNumber": 133, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 41, "kind": "member", "name": "otherKey", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#otherKey", "access": null, "description": null, "lineNumber": 134, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 42, "kind": "member", "name": "otherKeyDefault", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#otherKeyDefault", "access": null, "description": null, "lineNumber": 137, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "boolean" ] } }, { "__docId__": 43, "kind": "member", "name": "otherKeyAttribute", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#otherKeyAttribute", "access": null, "description": null, "lineNumber": 140, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "{}" ] } }, { "__docId__": 44, "kind": "member", "name": "otherKey", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#otherKey", "access": null, "description": null, "lineNumber": 141, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 45, "kind": "member", "name": "paired", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#paired", "access": null, "description": null, "lineNumber": 163, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 46, "kind": "member", "name": "options", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#options", "access": null, "description": null, "lineNumber": 181, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 47, "kind": "member", "name": "otherKey", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#otherKey", "access": null, "description": null, "lineNumber": 187, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 48, "kind": "member", "name": "throughModel", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#throughModel", "access": null, "description": null, "lineNumber": 201, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 49, "kind": "member", "name": "associationAccessor", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#associationAccessor", "access": null, "description": null, "lineNumber": 206, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 50, "kind": "member", "name": "accessors", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#accessors", "access": null, "description": null, "lineNumber": 212, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "{\"get\": *, \"set\": *, \"addMultiple\": *, \"add\": *, \"create\": *, \"remove\": *, \"removeMultiple\": *, \"hasSingle\": *, \"hasAll\": *, \"count\": *}" ] } }, { "__docId__": 51, "kind": "method", "name": "injectAttributes", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "generator": false, "async": false, "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#injectAttributes", "access": null, "description": null, "lineNumber": 228, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "params": [], "return": { "types": [ "*" ] } }, { "__docId__": 52, "kind": "member", "name": "identifier", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#identifier", "access": null, "description": null, "lineNumber": 230, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 53, "kind": "member", "name": "foreignIdentifier", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#foreignIdentifier", "access": null, "description": null, "lineNumber": 231, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 54, "kind": "member", "name": "primaryKeyDeleted", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#primaryKeyDeleted", "access": null, "description": null, "lineNumber": 245, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "boolean" ] } }, { "__docId__": 55, "kind": "member", "name": "identifierField", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#identifierField", "access": null, "description": null, "lineNumber": 304, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 56, "kind": "member", "name": "foreignIdentifierField", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#foreignIdentifierField", "access": null, "description": null, "lineNumber": 305, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 57, "kind": "member", "name": "toSource", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#toSource", "access": null, "description": null, "lineNumber": 313, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 58, "kind": "member", "name": "manyFromSource", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#manyFromSource", "access": null, "description": null, "lineNumber": 316, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 59, "kind": "member", "name": "oneFromSource", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#oneFromSource", "access": null, "description": null, "lineNumber": 319, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 60, "kind": "member", "name": "toTarget", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#toTarget", "access": null, "description": null, "lineNumber": 324, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 61, "kind": "member", "name": "manyFromTarget", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#manyFromTarget", "access": null, "description": null, "lineNumber": 327, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 62, "kind": "member", "name": "oneFromTarget", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#oneFromTarget", "access": null, "description": null, "lineNumber": 330, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 63, "kind": "method", "name": "mixin", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "generator": false, "async": false, "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#mixin", "access": null, "description": null, "lineNumber": 351, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "params": [ { "name": "obj", "types": [ "*" ] } ] }, { "__docId__": 64, "kind": "method", "name": "get", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "generator": false, "async": false, "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#get", "access": null, "description": "Get everything currently associated with this, using an optional where clause.", "see": [ "{@link Model.findAll} for a full explanation of options" ], "lineNumber": 373, "params": [ { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "options", "description": "" }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "options.where", "description": "An optional where clause to limit the associated models" }, { "nullable": null, "types": [ "String", "Boolean" ], "spread": false, "optional": true, "name": "options.scope", "description": "Apply a scope on the related model, or remove its default scope by passing false" }, { "nullable": null, "types": [ "String" ], "spread": false, "optional": true, "name": "options.schema", "description": "Apply a schema on the related model" } ], "return": { "nullable": null, "types": [ "Promise<Array<Model>>" ], "spread": false, "description": "" } }, { "__docId__": 65, "kind": "method", "name": "count", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "generator": false, "async": false, "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#count", "access": null, "description": "Count everything currently associated with this, using an optional where clause.", "lineNumber": 440, "params": [ { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "options", "description": "" }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "options.where", "description": "An optional where clause to limit the associated models" }, { "nullable": null, "types": [ "String", "Boolean" ], "spread": false, "optional": true, "name": "options.scope", "description": "Apply a scope on the related model, or remove its default scope by passing false" } ], "return": { "nullable": null, "types": [ "Promise<Integer>" ], "spread": false, "description": "" } }, { "__docId__": 66, "kind": "method", "name": "has", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "generator": false, "async": false, "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#has", "access": null, "description": "Check if one or more instance(s) are associated with this. If a list of instances is passed, the function returns true if _all_ instances are associated", "lineNumber": 463, "params": [ { "nullable": null, "types": [ "Model[]", "Model", "string[]", "String", "number[]", "Number" ], "spread": false, "optional": true, "name": "instance(s)", "description": "Can be an array of instances or their primary keys" }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "options", "description": "Options passed to getAssociations" } ], "return": { "nullable": null, "types": [ "Promise<boolean>" ], "spread": false, "description": "" } }, { "__docId__": 67, "kind": "method", "name": "set", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "generator": false, "async": false, "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#set", "access": null, "description": "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.", "lineNumber": 506, "params": [ { "nullable": null, "types": [ "Array<Model|String|Number>" ], "spread": false, "optional": true, "name": "newAssociations", "description": "An array of persisted instances or primary key of instances to associate with this. Pass `null` or `undefined` to remove all associations." }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "options", "description": "Options passed to `through.findAll`, `bulkCreate`, `update` and `destroy`" }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "options.validate", "description": "Run validation for the join model" }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "options.through", "description": "Additional attributes for the join table." } ], "return": { "nullable": null, "types": [ "Promise" ], "spread": false, "description": "" } }, { "__docId__": 68, "kind": "method", "name": "add", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "generator": false, "async": false, "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#add", "access": null, "description": "Associate one ore several rows with `this`.", "lineNumber": 599, "params": [ { "nullable": null, "types": [ "Model[]", "Model", "string[]", "string", "number[]", "Number" ], "spread": false, "optional": true, "name": "newAssociation(s)", "description": "A single instance or primary key, or a mixed array of persisted instances or primary keys" }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "options", "description": "Options passed to `through.findAll`, `bulkCreate` and `update`" }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "options.validate", "description": "Run validation for the join model." }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "options.through", "description": "Additional attributes for the join table." } ], "return": { "nullable": null, "types": [ "Promise" ], "spread": false, "description": "" } }, { "__docId__": 69, "kind": "method", "name": "remove", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "generator": false, "async": false, "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#remove", "access": null, "description": "Un-associate one or more instance(s).", "lineNumber": 681, "params": [ { "nullable": null, "types": [ "Model", "String", "Number" ], "spread": false, "optional": true, "name": "oldAssociated", "description": "Can be an Instance or its primary key, or a mixed array of instances and primary keys" }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "options", "description": "Options passed to `through.destroy`" } ], "return": { "nullable": null, "types": [ "Promise" ], "spread": false, "description": "" } }, { "__docId__": 70, "kind": "method", "name": "create", "memberof": "lib/associations/belongs-to-many.js~BelongsToMany", "generator": false, "async": false, "static": false, "longname": "lib/associations/belongs-to-many.js~BelongsToMany#create", "access": null, "description": "Create a new instance of the associated model and associate it with this.", "lineNumber": 703, "params": [ { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "values", "description": "" }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "options", "description": "Options passed to create and add" }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "options.through", "description": "Additional attributes for the join table" } ], "return": { "nullable": null, "types": [ "Promise" ], "spread": false, "description": "" } }, { "__docId__": 71, "kind": "file", "name": "lib/associations/belongs-to.js", "content": "", "static": true, "longname": "lib/associations/belongs-to.js", "access": null, "description": null, "lineNumber": 1 }, { "__docId__": 72, "kind": "variable", "name": "Utils", "memberof": "lib/associations/belongs-to.js", "static": true, "longname": "lib/associations/belongs-to.js~Utils", "access": null, "export": false, "importPath": "sequelize/lib/associations/belongs-to.js", "importStyle": null, "description": null, "lineNumber": 3, "undocument": true, "unknown": [ { "tagName": "@_undocument", "tagValue": "" } ], "type": { "types": [ "*" ] } }, { "__docId__": 73, "kind": "variable", "name": "Helpers", "memberof": "lib/associations/belongs-to.js", "static": true, "longname": "lib/associations/belongs-to.js~Helpers", "access": null, "export": false, "importPath": "sequelize/lib/associations/belongs-to.js", "importStyle": null, "description": null, "lineNumber": 4, "undocument": true, "unknown": [ { "tagName": "@_undocument", "ta