Function: PrimaryKey()
PrimaryKey(
options?):PropertyDecorator
Defined in: src/decorators/PrimaryKey.ts:18
Property decorator designating a property as the primary key of the entity.
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | PrimaryKeyOptions | Configuration options such as autoIncrement. |
Returns
PropertyDecorator
Usecase
Designate unique record identifiers for find(), update(), remove(), and relation joins.
Example
@PrimaryKey({ autoIncrement: true })
id!: number;