Skip to main content
Module

x/typeorm/src/index.ts>EntitySubscriberInterface

Forked from https://github.com/typeorm/typeorm
Latest
interface EntitySubscriberInterface
import { type EntitySubscriberInterface } from "https://deno.land/x/typeorm@v0.2.23-rc10/src/index.ts";

Classes that implement this interface are subscribers that subscribe for the specific events in the ORM.

Type Parameters

optional
Entity = any

Methods

optional
listenTo(): Function | string

Returns the class of the entity to which events will listen. If this method is omitted, then subscriber will listen to events of all entities.

optional
afterLoad(entity: Entity, event?: LoadEvent<Entity>): Promise<any> | void

Called after entity is loaded from the database.

For backward compatibility this signature is slightly different from the others. event was added later but is always provided (it is only optional in the signature so that its introduction does not break compilation for existing subscribers).

optional
beforeInsert(event: InsertEvent<Entity>): Promise<any> | void

Called before entity is inserted to the database.

optional
afterInsert(event: InsertEvent<Entity>): Promise<any> | void

Called after entity is inserted to the database.

optional
beforeUpdate(event: UpdateEvent<Entity>): Promise<any> | void

Called before entity is updated in the database.

optional
afterUpdate(event: UpdateEvent<Entity>): Promise<any> | void

Called after entity is updated in the database.

optional
beforeRemove(event: RemoveEvent<Entity>): Promise<any> | void

Called before entity is removed from the database.

optional
afterRemove(event: RemoveEvent<Entity>): Promise<any> | void

Called after entity is removed from the database.