Skip to content

postgrelize / BeforeSave

Variable: BeforeSave ​

const BeforeSave: ModelStaticMethodDecorator

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

Registers the decorated static method as a beforeSave hook of the model (like Model.beforeSave). 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 {
  @BeforeSave
  static async onBeforeSave(user: User, options: unknown) {}
}

Released under the MIT License.