Skip to main content
Version: Next

Class: EntityComparator

core.EntityComparator

Constructors#

constructor#

new EntityComparator(metadata, platform)

Parameters#

NameType
metadataIMetadataStorage
platformPlatform

Defined in#

packages/core/src/utils/EntityComparator.ts:21

Methods#

diffEntities#

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

Computes difference between two entities.

Type parameters#

NameType
TT: EntityData<T>

Parameters#

NameType
entityNamestring
aT
bT

Returns#

EntityData<T>

Defined in#

packages/core/src/utils/EntityComparator.ts:29


mapResult#

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

Maps database columns to properties.

Type parameters#

NameType
TT: AnyEntity<T>

Parameters#

NameType
entityNamestring
resultEntityDictionary<T>

Returns#

null | EntityData<T>

Defined in#

packages/core/src/utils/EntityComparator.ts:46


prepareEntity#

prepareEntity<T>(entity): 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
TT: AnyEntity<T>

Parameters#

NameType
entityT

Returns#

EntityData<T>

Defined in#

packages/core/src/utils/EntityComparator.ts:38


isComparable#

Static isComparable<T>(prop, root): boolean

perf: used to generate list of comparable properties during discovery, so we speed up the runtime comparison

Type parameters#

NameType
TT: AnyEntity<T>

Parameters#

NameType
propEntityProperty<T>
rootEntityMetadata<any>

Returns#

boolean

Defined in#

packages/core/src/utils/EntityComparator.ts:489