Options
All
  • Public
  • Public/Protected
  • All
Menu

Executes all database operations (inserts, updated, deletes) that must be executed with given persistence subjects.

Hierarchy

  • SubjectExecutor

Index

Constructors

constructor

Properties

Protected allSubjects

allSubjects: Subject[]

All subjects that needs to be operated.

hasExecutableOperations

hasExecutableOperations: boolean = false

Indicates if executor has any operations to execute (e.g. has insert / update / delete operations to be executed).

Protected insertSubjects

insertSubjects: Subject[] = []

Subjects that must be inserted.

Protected Optional options

Persistence options.

Protected queryRunner

queryRunner: QueryRunner

QueryRunner used to execute all queries with a given subjects.

Protected removeSubjects

removeSubjects: Subject[] = []

Subjects that must be removed.

Protected updateSubjects

updateSubjects: Subject[] = []

Subjects that must be updated.

Methods

Protected broadcastAfterEventsForAll

  • Broadcasts "AFTER_INSERT", "AFTER_UPDATE", "AFTER_REMOVE" events for all given subjects. Returns void if there wasn't any listener or subscriber executed. Note: this method has a performance-optimized code organization.

    Returns BroadcasterResult

Protected broadcastBeforeEventsForAll

execute

  • execute(): Promise<void>
  • Executes all operations over given array of subjects. Executes queries using given query runner.

    Returns Promise<void>

Protected executeInsertOperations

  • executeInsertOperations(): Promise<void>

Protected executeRemoveOperations

  • executeRemoveOperations(): Promise<void>

Protected executeUpdateOperations

  • executeUpdateOperations(): Promise<void>

Protected groupBulkSubjects

  • groupBulkSubjects(subjects: Subject[], type: "insert" | "delete"): [object, string[]]
  • Groups subjects by metadata names (by tables) to make bulk insertions and deletions possible. However there are some limitations with bulk insertions of data into tables with generated (increment) columns in some drivers. Some drivers like mysql and sqlite does not support returning multiple generated columns after insertion and can only return a single generated column value, that's why its not possible to do bulk insertion, because it breaks insertion result's generatedMap and leads to problems when this subject is used in other subjects saves. That's why we only support bulking in junction tables for those drivers.

    Other drivers like postgres and sql server support RETURNING / OUTPUT statement which allows to return generated id for each inserted row, that's why bulk insertion is not limited to junction tables in there.

    Parameters

    • subjects: Subject[]
    • type: "insert" | "delete"

    Returns [object, string[]]

Protected recompute

  • recompute(): void

Protected updateSpecialColumnsInInsertedAndUpdatedEntities

  • updateSpecialColumnsInInsertedAndUpdatedEntities(subjects: Subject[]): void
  • Updates all special columns of the saving entities (create date, update date, version, etc.). Also updates nullable columns and columns with default values.

    Parameters

    Returns void

Protected updateSpecialColumnsInPersistedEntities

  • updateSpecialColumnsInPersistedEntities(): void
  • Updates all special columns of the saving entities (create date, update date, version, etc.). Also updates nullable columns and columns with default values.

    Returns void

Protected validate

  • validate(): void

Generated using TypeDoc