Skip to main content
Version: 6.1

SerializedPrimaryKeyOptions <T>

Hierarchy

Index

Properties

optionalautoincrement

autoincrement?: boolean

Explicitly specify the auto increment of the primary key.

optionalcheck

check?: string | CheckCallback<T>

Specify column with check constraints. (Postgres driver only)

@see

optionalcolumnType

columnType?: AnyString | ColumnType

Specify exact database column type for Generator. (SQL only)

optionalcomment

comment?: string

Specify comment of column for Generator. (SQL only)

optionalconcurrencyCheck

concurrencyCheck?: boolean

Set to true to enable Locking via concurrency fields.

optionalcustomOrder

customOrder?: string[] | number[] | boolean[]

Specify a custom order based on the values. (SQL only)

optionaldefault

default?: null | string | number | boolean | string[] | number[]

Specify default column value for Generator. This is a runtime value, assignable to the entity property. (SQL only)

optionaldefaultRaw

defaultRaw?: string

Specify SQL functions for Generator. (SQL only) Since v4 you should use defaultRaw for SQL functions. e.g. now()

optionalextra

extra?: string

mysql only

optionalfieldName

fieldName?: string

Specify database column name for this property.

@see

optionalfieldNames

fieldNames?: string[]

Specify database column names for this property. Same as fieldName but for composite FKs.

@see

optionalformula

formula?: string | (alias: string) => string

Set to map some SQL snippet for the entity.

@see

optionalgenerated

generated?: string | GeneratedColumnCallback<T>

For generated columns. This will be appended to the column type after the generated always clause.

optionalgetter

getter?: boolean

Set true to define the properties as getter. (virtual)

@example
@Property({ getter: true })
get fullName() {
return this.firstName + this.lastName;
}

optionalhidden

hidden?: boolean

Set to true to omit the property when Serializing.

optionalhydrate

hydrate?: boolean

Set false to disable hydration of this property. Useful for persisted getters.

optionalignoreSchemaChanges

ignoreSchemaChanges?: (type | extra)[]

Set to avoid a perpetual diff from the Generator when columns are generated.

@see

optionalindex

index?: string | boolean

Explicitly specify index on a property.

optionallazy

lazy?: boolean

Set to omit the property from the select clause for lazy loading.

@see

optionallength

length?: number

Set length of database column, used for datetime/timestamp/varchar column types for Generator. (SQL only)

optionalname

name?: string

Alias for fieldName.

optionalnullable

nullable?: boolean

Set column as nullable for Generator.

optionalonCreate

onCreate?: (entity: T, em: EntityManager<IDatabaseDriver<Connection>>) => any

Type declaration

optionalonUpdate

onUpdate?: (entity: T, em: EntityManager<IDatabaseDriver<Connection>>) => any

Type declaration

optionalpersist

persist?: boolean

Set false to define Property.

optionalprecision

precision?: number

Set precision of database column to represent the number of significant digits. (SQL only)

optionalprimary

primary?: boolean

Set true to define entity's unique primary key identifier. Alias for @PrimaryKey() decorator

@see

optionalref

ref?: boolean

Enable ScalarReference wrapper for lazy values. Use this in combination with lazy: true to have a type-safe accessor object in place of the value.

optionalreturning

returning?: boolean

Add the property to the returning statement.

optionalscale

scale?: number

Set scale of database column to represents the number of digits after the decimal point. (SQL only)

optionalserializedName

serializedName?: string

Specify name of key for the serialized value.

optionalserializedPrimaryKey

serializedPrimaryKey?: boolean

Set to define serialized primary key for MongoDB. (virtual) Alias for @SerializedPrimaryKey() decorator.

@see

optionalserializer

serializer?: (value: any) => any

Type declaration

optionalsetter

setter?: boolean

Set true to define the properties as setter. (virtual)

@example
@Property({ setter: true })
set address(value: string) {
this._address = value.toLocaleLowerCase();
}

optionaltrackChanges

trackChanges?: boolean

Set false to disable change tracking on a property level.

@see

optionaltype

type?: any

optionalunique

unique?: string | boolean

Set column as unique for Generator. (SQL only)

optionalunsigned

unsigned?: boolean

Set column as unsigned for Generator. (SQL only)

optionalversion

version?: boolean

Set to true to enable Locking via version field. (SQL only)