Skip to main content

Function: ConcurrencyCheck()

ConcurrencyCheck(): PropertyDecorator

Defined in: src/decorators/Version.ts:86

Property decorator that verifies an individual property hasn't changed before executing UPDATE or DELETE.

Injects WHERE column = original_value into the mutation SQL. If the value has changed in the database, zero rows are affected and a DbUpdateConcurrencyException is raised.

Returns​

PropertyDecorator

Usecase​

Protect sensitive business fields (like account balances or order statuses) from concurrent overwrite without a dedicated version column.

Example​

@ConcurrencyCheck()
balance!: number;