Skip to main content
Version: 4.4

Class: EntityComparator#

core.EntityComparator

Hierarchy#

  • EntityComparator

Constructors#

constructor#

+ new EntityComparator(metadata: IMetadataStorage, platform: Platform): EntityComparator

Parameters:#

NameType
metadataIMetadataStorage
platformPlatform

Returns: EntityComparator

Defined in: packages/core/src/utils/EntityComparator.ts:19

Properties#

comparators#

Private Readonly comparators: Map<string, Comparator<any>>

Defined in: packages/core/src/utils/EntityComparator.ts:15


mappers#

Private Readonly mappers: Map<string, ResultMapper<any>>

Defined in: packages/core/src/utils/EntityComparator.ts:16


pkGetters#

Private Readonly pkGetters: Map<string, PkGetter<any>>

Defined in: packages/core/src/utils/EntityComparator.ts:18


pkSerializers#

Private Readonly pkSerializers: Map<string, PkSerializer<any>>

Defined in: packages/core/src/utils/EntityComparator.ts:19


snapshotGenerators#

Private Readonly snapshotGenerators: Map<string, SnapshotGenerator<any>>

Defined in: packages/core/src/utils/EntityComparator.ts:17

Methods#

diffEntities#

diffEntities<T>(entityName: string, a: T, b: T): EntityData<T>

Computes difference between two entities.

Type parameters:#

NameType
TEntityData<T>

Parameters:#

NameType
entityNamestring
aT
bT

Returns: EntityData<T>

Defined in: packages/core/src/utils/EntityComparator.ts:27


getEmbeddedPropertySnapshot#

PrivategetEmbeddedPropertySnapshot<T>(meta: EntityMetadata<T>, prop: EntityProperty<T>, context: Map<string, any>, level?: number, path?: string[]): string

Type parameters:#

Name
T

Parameters:#

NameTypeDefault value
metaEntityMetadata<T>-
propEntityProperty<T>-
contextMap<string, any>-
levelnumber1
pathstring[]...

Returns: string

Defined in: packages/core/src/utils/EntityComparator.ts:225


getEntityComparator#

getEntityComparator<T>(entityName: string): Comparator<T>

internal Highly performance-sensitive method.

Type parameters:#

Name
T

Parameters:#

NameType
entityNamestring

Returns: Comparator<T>

Defined in: packages/core/src/utils/EntityComparator.ts:292


getGenericComparator#

PrivategetGenericComparator(prop: string, cond: string): string

Parameters:#

NameType
propstring
condstring

Returns: string

Defined in: packages/core/src/utils/EntityComparator.ts:318


getPkGetter#

getPkGetter<T>(meta: EntityMetadata<T>): any

internal Highly performance-sensitive method.

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
metaEntityMetadata<T>

Returns: any

Defined in: packages/core/src/utils/EntityComparator.ts:52


getPkSerializer#

getPkSerializer<T>(meta: EntityMetadata<T>): any

internal Highly performance-sensitive method.

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
metaEntityMetadata<T>

Returns: any

Defined in: packages/core/src/utils/EntityComparator.ts:94


getPropertyComparator#

PrivategetPropertyComparator<T>(prop: EntityProperty<T>): string

Type parameters:#

Name
T

Parameters:#

NameType
propEntityProperty<T>

Returns: string

Defined in: packages/core/src/utils/EntityComparator.ts:327


getPropertyCondition#

PrivategetPropertyCondition<T>(prop: EntityProperty<T>): string

Type parameters:#

Name
T

Parameters:#

NameType
propEntityProperty<T>

Returns: string

Defined in: packages/core/src/utils/EntityComparator.ts:209


getPropertySnapshot#

PrivategetPropertySnapshot<T>(meta: EntityMetadata<T>, prop: EntityProperty<T>, context: Map<string, any>): string

Type parameters:#

Name
T

Parameters:#

NameType
metaEntityMetadata<T>
propEntityProperty<T>
contextMap<string, any>

Returns: string

Defined in: packages/core/src/utils/EntityComparator.ts:238


getResultMapper#

getResultMapper<T>(entityName: string): ResultMapper<T>

internal Highly performance-sensitive method.

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entityNamestring

Returns: ResultMapper<T>

Defined in: packages/core/src/utils/EntityComparator.ts:172


getSnapshotGenerator#

getSnapshotGenerator<T>(entityName: string): SnapshotGenerator<T>

internal Highly performance-sensitive method.

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entityNamestring

Returns: SnapshotGenerator<T>

Defined in: packages/core/src/utils/EntityComparator.ts:135


mapResult#

mapResult<T>(entityName: string, result: EntityData<T>): null | EntityData<T>

Maps database columns to properties.

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entityNamestring
resultEntityData<T>

Returns: null | EntityData<T>

Defined in: packages/core/src/utils/EntityComparator.ts:44


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:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entityT

Returns: EntityData<T>

Defined in: packages/core/src/utils/EntityComparator.ts:36


isComparable#

StaticisComparable<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:#

NameType
TAnyEntity<T>

Parameters:#

NameType
propEntityProperty<T>
rootEntityMetadata<any>

Returns: boolean

Defined in: packages/core/src/utils/EntityComparator.ts:371

Last updated on by Martin Adámek