Skip to main content
Version: 5.9

EntityComparator

Index

Constructors

constructor

  • new EntityComparator(metadata: IMetadataStorage, platform: Platform): EntityComparator
  • Parameters

    • metadata: IMetadataStorage
    • platform: Platform

    Returns EntityComparator

Methods

diffEntities

  • diffEntities<T>(entityName: string, a: EntityData<T>, b: EntityData<T>): EntityData<T>
  • Computes difference between two entities.


    Type parameters

    • T

    Parameters

    • entityName: string
    • a: EntityData<T>
    • b: EntityData<T>

    Returns EntityData<T>

mapResult

  • mapResult<T>(entityName: string, result: EntityDictionary<T>): null | EntityData<T>
  • Maps database columns to properties.


    Type parameters

    • T

    Parameters

    • entityName: string
    • result: EntityDictionary<T>

    Returns null | EntityData<T>

matching

  • matching<T>(entityName: string, a: EntityData<T>, b: EntityData<T>): boolean
  • Type parameters

    • T

    Parameters

    • entityName: string
    • a: EntityData<T>
    • b: EntityData<T>

    Returns boolean

prepareEntity

  • prepareEntity<T>(entity: T): EntityData<T>
  • Removes ORM specific code from entities and prepares it for serializing. Used before change set computation. References will be mapped to primary keys, collections to arrays of primary keys.


    Type parameters

    • T

    Parameters

    • entity: T

    Returns EntityData<T>

staticisComparable

  • isComparable<T>(prop: EntityProperty<T>, root: EntityMetadata<any>): boolean
  • perf: used to generate list of comparable properties during discovery, so we speed up the runtime comparison


    Type parameters

    • T

    Parameters

    • prop: EntityProperty<T>
    • root: EntityMetadata<any>

    Returns boolean