Skip to main content
Version: 5.2

UnitOfWork

Index

Constructors

constructor

Methods

cancelOrphanRemoval

clear

  • clear(): void
  • Returns void

clearActionsQueue

  • clearActionsQueue(): void
  • Returns void

commit

  • commit(): Promise<void>
  • Returns Promise<void>

computeChangeSet

  • computeChangeSet<T>(entity: T): void
  • Type parameters

    Parameters

    • entity: T

    Returns void

computeChangeSets

  • computeChangeSets(): void
  • Returns void

getById

  • getById<T>(entityName: string, id: Primary<T> | Primary<T>[], schema?: string): undefined | T
  • Returns entity from the identity map. For composite keys, you need to pass an array of PKs in the same order as they are defined in meta.primaryKeys.


    Type parameters

    Parameters

    Returns undefined | T

getChangeSets

getCollectionUpdates

getExtraUpdates

getIdentityMap

  • Returns map of all managed entities.


    Returns IdentityMap

getOriginalEntityData

  • getOriginalEntityData<T>(): AnyEntity<any>[]
  • getOriginalEntityData<T>(entity: T): undefined | EntityData<T>
  • Returns stored snapshot of entity state that is used for change set computation.

    @deprecated

    use uow.getOriginalEntityData(entity)


    Type parameters

    Returns AnyEntity<any>[]

getPersistStack

getRemoveStack

lock

  • lock<T>(entity: T, options: LockOptions): Promise<void>

merge

  • merge<T>(entity: T, visited?: Set<AnyEntity<any>>): void
  • Type parameters

    Parameters

    • entity: T
    • optionalvisited: Set<AnyEntity<any>>

    Returns void

persist

  • persist<T>(entity: T, visited?: Set<AnyEntity<any>>, options?: { cascade?: boolean; checkRemoveStack?: boolean }): void
  • Type parameters

    Parameters

    • entity: T
    • optionalvisited: Set<AnyEntity<any>>
    • options: { cascade?: boolean; checkRemoveStack?: boolean } = {}

    Returns void

recomputeSingleChangeSet

  • recomputeSingleChangeSet<T>(entity: T): void
  • Type parameters

    Parameters

    • entity: T

    Returns void

remove

  • remove<T>(entity: T, visited?: Set<AnyEntity<any>>, options?: { cascade?: boolean }): void
  • Type parameters

    Parameters

    • entity: T
    • optionalvisited: Set<AnyEntity<any>>
    • options: { cascade?: boolean } = {}

    Returns void

scheduleExtraUpdate

scheduleOrphanRemoval

shouldAutoFlush

tryGetById

  • tryGetById<T>(entityName: string, where: FilterQuery<T>, schema?: string, strict?: boolean): null | T
  • Type parameters

    Parameters

    • entityName: string
    • where: FilterQuery<T>
    • optionalschema: string
    • strict: boolean = true

    Returns null | T

unsetIdentity