Skip to content

postgrelize / BeforeUpsert

Variable: BeforeUpsert ​

const BeforeUpsert: ModelStaticMethodDecorator

Defined in: src/decorators/hook-decorators.ts:212

Registers the decorated static method as a beforeUpsert hook of the model (like Model.beforeUpsert). The method receives the hook arguments; static methods only. Registered when sequelize.addModels applies the class. Accepts the TC39 and the legacy experimentalDecorators call signature.

Example ​

ts
class User extends Model {
  @BeforeUpsert
  static async onBeforeUpsert(values: unknown, options: unknown) {}
}

Released under the MIT License.