Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface BelongsToManySetAssociationsMixin<TInstance, TInstancePrimaryKey, TJoinTableAttributes>

The setAssociations mixin applied to models with belongsToMany. An example of usage is as follows:


User.belongsToMany(Role, { through: UserRole });

interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
   // getRoles...
   setRoles: Sequelize.BelongsToManySetAssociationsMixin<RoleInstance, RoleId, UserRoleAttributes>;
   // addRoles...
   // addRole...
   // createRole...
   // removeRole...
   // removeRoles...
   // hasRole...
   // hasRoles...
   // countRoles...
}
see

http://docs.sequelizejs.com/en/latest/api/associations/belongs-to-many/

see

Instance

Type parameters

  • TInstance

  • TInstancePrimaryKey

  • TJoinTableAttributes

Hierarchy

  • BelongsToManySetAssociationsMixin

Callable

  • 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.

    
    User.belongsToMany(Role, { through: UserRole });
    
    interface UserInstance extends Sequelize.Instance<UserInstance, UserAttributes>, UserAttributes {
       // getRoles...
       setRoles: Sequelize.BelongsToManySetAssociationsMixin<RoleInstance, RoleId, UserRoleAttributes>;
       // addRoles...
       // addRole...
       // createRole...
       // removeRole...
       // removeRoles...
       // hasRole...
       // hasRoles...
       // countRoles...
    }
    

    Parameters

    Returns Promise<void>

Generated using TypeDoc