PropertyOptions <Owner>
Hierarchy
Index
Properties
- autoincrement
- check
- columnType
- comment
- concurrencyCheck
- customOrder
- default
- defaultRaw
- extra
- fieldName
- fieldNames
- formula
- generated
- getter
- getterName
- groups
- hidden
- hydrate
- ignoreSchemaChanges
- index
- lazy
- length
- name
- nullable
- onCreate
- onUpdate
- persist
- precision
- primary
- ref
- returning
- runtimeType
- scale
- serializedName
- serializedPrimaryKey
- serializer
- setter
- trackChanges
- type
- unique
- unsigned
- version
Properties
optionalautoincrement
optionalcheck
Specify column with check constraints. (Postgres driver only)
optionalcolumnType
Specify exact database column type for Generator. (SQL only)
optionalcomment
Specify comment of column for Generator. (SQL only)
optionalconcurrencyCheck
Set to true to enable Locking via concurrency fields.
optionalcustomOrder
Specify a custom order based on the values. (SQL only)
optionaldefault
Specify default column value for Generator. This is a runtime value, assignable to the entity property. (SQL only)
optionaldefaultRaw
Specify SQL functions for Generator. (SQL only) Since v4 you should use defaultRaw for SQL functions. e.g. now()
optionalextra
mysql only
optionalfieldName
Specify database column name for this property.
optionalfieldNames
Specify database column names for this property.
Same as fieldName
but for composite FKs.
optionalformula
Set to map some SQL snippet for the entity.
optionalgenerated
For generated columns. This will be appended to the column type after the generated always
clause.
optionalgetter
Set true to define the properties as getter. (virtual)
optionalgetterName
When defining a property over a method (not a getter, a regular function), you can use this option to point to the method name.
optionalgroups
Specify serialization groups for serialize()
calls. If a property does not specify any group, it will be included,
otherwise only properties with a matching group are included.
optionalhidden
Set to true to omit the property when Serializing.
optionalhydrate
Set false to disable hydration of this property. Useful for persisted getters.
optionalignoreSchemaChanges
Set to avoid a perpetual diff from the Generator when columns are generated.
optionalindex
Explicitly specify index on a property.
optionallazy
Set to omit the property from the select clause for lazy loading.
optionallength
Set length of database column, used for datetime/timestamp/varchar column types for Generator. (SQL only)
optionalname
Alias for fieldName
.
optionalnullable
Set column as nullable for Generator.
optionalonCreate
Automatically set the property value when entity gets created, executed during flush operation.
Type declaration
Parameters
entity: Owner
em: EntityManager<IDatabaseDriver<Connection>>
Returns any
optionalonUpdate
Automatically update the property value every time entity gets updated, executed during flush operation.
Type declaration
Parameters
entity: Owner
em: EntityManager<IDatabaseDriver<Connection>>
Returns any
optionalpersist
Set false to define Property.
optionalprecision
Set precision of database column to represent the number of significant digits. (SQL only)
optionalprimary
Set true to define entity's unique primary key identifier.
Alias for @PrimaryKey()
decorator
optionalref
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
Add the property to the returning
statement.
optionalruntimeType
Runtime type of the property. This is the JS type that your property is mapped to, e.g. string
or number
, and is normally inferred automatically via reflect-metadata
.
In some cases, the inference won't work, and you might need to specify the runtimeType
explicitly - the most common one is when you use a union type with null like foo: number | null
.
optionalscale
Set scale of database column to represents the number of digits after the decimal point. (SQL only)
optionalserializedName
Specify name of key for the serialized value.
optionalserializedPrimaryKey
Set to define serialized primary key for MongoDB. (virtual)
Alias for @SerializedPrimaryKey()
decorator.
optionalserializer
Set to use serialize property. Allow to specify a callback that will be used when serializing a property.
Type declaration
Parameters
value: any
optionaloptions: SerializeOptions<any, never, never>
Returns any
optionalsetter
Set true to define the properties as setter. (virtual)
optionaltrackChanges
Set false to disable change tracking on a property level.
optionaltype
Explicitly specify the runtime type.
optionalunique
Set column as unique for Generator. (SQL only)
optionalunsigned
Set column as unsigned for Generator. (SQL only)
optionalversion
Set to true to enable Locking via version field. (SQL only)
Explicitly specify the auto increment of the primary key.