Version: 4.3

Class: ChangeSetPersister

Hierarchy

  • ChangeSetPersister

Constructors

constructor

+ new ChangeSetPersister(driver: IDatabaseDriver, metadata: MetadataStorage, hydrator: IHydrator, factory: EntityFactory, config: Configuration): ChangeSetPersister

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:12

Parameters:

NameType
driverIDatabaseDriver
metadataMetadataStorage
hydratorIHydrator
factoryEntityFactory
configConfiguration

Returns: ChangeSetPersister

Properties

config

Private Readonly config: Configuration

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:18


driver

Private Readonly driver: IDatabaseDriver

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:14


factory

Private Readonly factory: EntityFactory

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:17


hydrator

Private Readonly hydrator: IHydrator

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:16


metadata

Private Readonly metadata: MetadataStorage

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:15


platform

Private Readonly platform: Platform = this.driver.getPlatform()

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:12

Methods

checkOptimisticLock

PrivatecheckOptimisticLock<T>(meta: EntityMetadata<T>, changeSet: ChangeSet<T>, res?: QueryResult): void

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:211

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
metaEntityMetadata<T>
changeSetChangeSet<T>
res?QueryResult

Returns: void


checkOptimisticLocks

PrivatecheckOptimisticLocks<T>(meta: EntityMetadata<T>, changeSets: ChangeSet<T>[], ctx?: Transaction): Promise<void>

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:192

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
metaEntityMetadata<T>
changeSetsChangeSet<T>[]
ctx?Transaction

Returns: Promise<void>


executeDeletes

executeDeletes<T>(changeSets: ChangeSet<T>[], ctx?: Transaction): Promise<void>

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:46

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
changeSetsChangeSet<T>[]
ctx?Transaction

Returns: Promise<void>


executeInserts

executeInserts<T>(changeSets: ChangeSet<T>[], ctx?: Transaction): Promise<void>

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:20

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
changeSetsChangeSet<T>[]
ctx?Transaction

Returns: Promise<void>


executeUpdates

executeUpdates<T>(changeSets: ChangeSet<T>[], batched: boolean, ctx?: Transaction): Promise<void>

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:33

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
changeSetsChangeSet<T>[]
batchedboolean
ctx?Transaction

Returns: Promise<void>


mapPrimaryKey

PrivatemapPrimaryKey<T>(meta: EntityMetadata<T>, value: IPrimaryKey, changeSet: ChangeSet<T>): void

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:142

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
metaEntityMetadata<T>
valueIPrimaryKey
changeSetChangeSet<T>

Returns: void


mapReturnedValues

PrivatemapReturnedValues<T>(changeSet: ChangeSet<T>, res: QueryResult, meta: EntityMetadata<T>): void

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:273

Maps values returned via returning statement (postgres) or the inserted id (other sql drivers). No need to handle composite keys here as they need to be set upfront. We do need to map to the change set payload too, as it will be used in the originalEntityData for new entities.

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
changeSetChangeSet<T>
resQueryResult
metaEntityMetadata<T>

Returns: void


markAsPopulated

PrivatemarkAsPopulated<T>(changeSet: ChangeSet<T>, meta: EntityMetadata<T>): void

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:162

Sets populate flag to new entities so they are serialized like if they were loaded from the db

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
changeSetChangeSet<T>
metaEntityMetadata<T>

Returns: void


persistManagedEntities

PrivatepersistManagedEntities<T>(meta: EntityMetadata<T>, changeSets: ChangeSet<T>[], ctx?: Transaction): Promise<void>

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:126

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
metaEntityMetadata<T>
changeSetsChangeSet<T>[]
ctx?Transaction

Returns: Promise<void>


persistManagedEntitiesBatch

PrivatepersistManagedEntitiesBatch<T>(meta: EntityMetadata<T>, changeSets: ChangeSet<T>[], ctx?: Transaction): Promise<void>

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:136

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
metaEntityMetadata<T>
changeSetsChangeSet<T>[]
ctx?Transaction

Returns: Promise<void>


persistManagedEntity

PrivatepersistManagedEntity<T>(changeSet: ChangeSet<T>, ctx?: Transaction): Promise<void>

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:118

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
changeSetChangeSet<T>
ctx?Transaction

Returns: Promise<void>


persistNewEntities

PrivatepersistNewEntities<T>(meta: EntityMetadata<T>, changeSets: ChangeSet<T>[], ctx?: Transaction): Promise<void>

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:86

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
metaEntityMetadata<T>
changeSetsChangeSet<T>[]
ctx?Transaction

Returns: Promise<void>


persistNewEntitiesBatch

PrivatepersistNewEntitiesBatch<T>(meta: EntityMetadata<T>, changeSets: ChangeSet<T>[], ctx?: Transaction): Promise<void>

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:99

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
metaEntityMetadata<T>
changeSetsChangeSet<T>[]
ctx?Transaction

Returns: Promise<void>


persistNewEntity

PrivatepersistNewEntity<T>(meta: EntityMetadata<T>, changeSet: ChangeSet<T>, ctx?: Transaction): Promise<void>

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:66

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
metaEntityMetadata<T>
changeSetChangeSet<T>
ctx?Transaction

Returns: Promise<void>


processProperties

PrivateprocessProperties<T>(changeSet: ChangeSet<T>): void

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:58

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
changeSetChangeSet<T>

Returns: void


processProperty

PrivateprocessProperty<T>(changeSet: ChangeSet<T>, prop: EntityProperty<T>): void

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:244

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
changeSetChangeSet<T>
propEntityProperty<T>

Returns: void


reloadVersionValues

PrivatereloadVersionValues<T>(meta: EntityMetadata<T>, changeSets: ChangeSet<T>[], ctx?: Transaction): Promise<void>

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:217

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
metaEntityMetadata<T>
changeSetsChangeSet<T>[]
ctx?Transaction

Returns: Promise<void>


updateEntity

PrivateupdateEntity<T>(meta: EntityMetadata<T>, changeSet: ChangeSet<T>, ctx?: Transaction): Promise<QueryResult>

Defined in packages/core/src/unit-of-work/ChangeSetPersister.ts:179

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
metaEntityMetadata<T>
changeSetChangeSet<T>
ctx?Transaction

Returns: Promise<QueryResult>

Last updated on by Martin Adámek