Type alias HasOneSetAssociationMixin<T, TModelPrimaryKey>

HasOneSetAssociationMixin<T, TModelPrimaryKey>: {
    (newAssociation: null, options?: HasOneSetAssociationMixinOptions<T>): Promise<null>;
    (newAssociation: T | TModelPrimaryKey, options?: HasOneSetAssociationMixinOptions<T>): Promise<T>;
}

Type Parameters

  • T extends Model

  • TModelPrimaryKey

Type declaration

    • (newAssociation: null, options?: HasOneSetAssociationMixinOptions<T>): Promise<null>
    • The setAssociation mixin applied to models with hasOne. An example of usage is as follows:

      class User extends Model<InferAttributes<User>, InferCreationAttributes<User>> {
      declare setRole: HasOneSetAssociationMixin<Role, Role['id']>;
      }

      User.hasOne(Role);

      See

      Model.hasOne

      Parameters

      Returns Promise<null>

    • (newAssociation: T | TModelPrimaryKey, options?: HasOneSetAssociationMixinOptions<T>): Promise<T>
    • The setAssociation mixin applied to models with hasOne. An example of usage is as follows:

      class User extends Model<InferAttributes<User>, InferCreationAttributes<User>> {
      declare setRole: HasOneSetAssociationMixin<Role, Role['id']>;
      }

      User.hasOne(Role);

      See

      Model.hasOne

      Parameters

      Returns Promise<T>

Generated using TypeDoc