Version: 4.3

Class: EntityComparator

Hierarchy

  • EntityComparator

Constructors

constructor

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

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

Parameters:

NameType
metadataIMetadataStorage
platformPlatform

Returns: EntityComparator

Properties

comparators

Private Readonly comparators: Map<string, Comparator<any>> = new Map<string, Comparator<any>>()

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


mappers

Private Readonly mappers: Map<string, ResultMapper<any>> = new Map<string, ResultMapper<any>>()

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


metadata

Private Readonly metadata: IMetadataStorage

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


pkGetters

Private Readonly pkGetters: Map<string, PkGetter<any>> = new Map<string, PkGetter<any>>()

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


pkSerializers

Private Readonly pkSerializers: Map<string, PkSerializer<any>> = new Map<string, PkSerializer<any>>()

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


platform

Private Readonly platform: Platform

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


snapshotGenerators

Private Readonly snapshotGenerators: Map<string, SnapshotGenerator<any>> = new 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>

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

Computes difference between two entities.

Type parameters:

NameType
TEntityData<T>

Parameters:

NameType
entityNamestring
aT
bT

Returns: EntityData<T>


getEntityComparator

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

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

internal Highly performance-sensitive method.

Type parameters:

Name
T

Parameters:

NameType
entityNamestring

Returns: Comparator<T>


getGenericComparator

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

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

Parameters:

NameType
propstring
condstring

Returns: string


getPkGetter

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

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

internal Highly performance-sensitive method.

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
metaEntityMetadata<T>

Returns: any


getPkSerializer

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

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

internal Highly performance-sensitive method.

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
metaEntityMetadata<T>

Returns: any


getPropertyComparator

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

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

Type parameters:

Name
T

Parameters:

NameType
propEntityProperty<T>

Returns: string


getPropertyCondition

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

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

Type parameters:

Name
T

Parameters:

NameType
propEntityProperty<T>

Returns: string


getPropertySnapshot

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

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

Type parameters:

Name
T

Parameters:

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

Returns: string


getResultMapper

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

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

internal Highly performance-sensitive method.

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
entityNamestring

Returns: ResultMapper<T>


getSnapshotGenerator

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

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

internal Highly performance-sensitive method.

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
entityNamestring

Returns: SnapshotGenerator<T>


mapResult

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

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

Maps database columns to properties.

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
entityNamestring
resultEntityData<T>

Returns: EntityData<T> | null


prepareEntity

prepareEntity<T>(entity: T): EntityData<T>

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

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>


isComparable

StaticisComparable<T>(prop: EntityProperty<T>, root: EntityMetadata): boolean

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

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

Returns: boolean

Last updated on by Martin Adámek