Original user-given table name (taken from schema or @Entity(tableName) decorator).
If user haven't specified a table name this property will be undefined.
hasMultiplePrimaryKeys
hasMultiplePrimaryKeys:boolean
Checks if entity's table has multiple primary columns.
hasNonNullableRelations
hasNonNullableRelations:boolean
Checks if there any non-nullable column exist in this entity.
hasUUIDGeneratedColumns
hasUUIDGeneratedColumns:boolean
Indicates if this entity metadata has uuid generated columns.
indices
indices:IndexMetadata[]
Entity's index metadatas.
可选inheritancePattern
inheritancePattern?:"STI"
If this entity metadata's table using one of the inheritance patterns,
then this will contain what pattern it uses.
inheritanceTree
inheritanceTree:Function[]
All "inheritance tree" from a target entity.
For example for target Post < ContentModel < Unit it will be an array of [Post, ContentModel, Unit].
It also contains child entities for single table inheritance.
inverseColumns
inverseColumns:ColumnMetadata[]
In the case if this entity metadata is junction table's entity metadata,
this will contain all referenced columns of inverse entity.
isAlwaysUsingConstructor
isAlwaysUsingConstructor:boolean
Indicates if the entity should be instantiated using the constructor
or via allocating a new object via Object.create().
isClosureJunction
isClosureJunction:boolean
Checks if this table is a junction table of the closure table.
This type is for tables that contain junction metadata of the closure tables.
isJunction
isJunction:boolean
Indicates if this entity metadata of a junction table, or not.
Junction table is a table created by many-to-many relationship.
Its also possible to understand if entity is junction via tableType.
lazyRelations
lazyRelations:RelationMetadata[]
List of eager relations this metadata has.
listeners
listeners:EntityListenerMetadata[]
Entity listener metadatas.
manyToManyRelations
manyToManyRelations:RelationMetadata[]
Gets only many-to-many relations of the entity.
manyToOneRelations
manyToOneRelations:RelationMetadata[]
Gets only many-to-one relations of the entity.
可选materializedPathColumn
materializedPathColumn?:ColumnMetadata
Materialized path column.
Used only in tree entities with materialized path pattern applied.
name
name:string
Entity's name.
Equal to entity target class's name if target is set to table.
If target class is not then then it equals to table name.
可选nestedSetLeftColumn
nestedSetLeftColumn?:ColumnMetadata
Nested set's left value column.
Used only in tree entities with nested set pattern applied.
可选nestedSetRightColumn
nestedSetRightColumn?:ColumnMetadata
Nested set's right value column.
Used only in tree entities with nested set pattern applied.
nonVirtualColumns
nonVirtualColumns:ColumnMetadata[]
All columns except for virtual columns.
可选objectIdColumn
objectIdColumn?:ColumnMetadata
Gets the object id column used with mongodb database.
example: Post{ id: number, name: string, counterEmbed: { count: number }, category: Category }.
This method will create following object:
{ id: "id", counterEmbed: { count: "counterEmbed.count" }, category: "category" }
relationCounts
relationCounts:RelationCountMetadata[]
Entity's relation id metadatas.
relationIds
relationIds:RelationIdMetadata[]
Entity's relation id metadatas.
relations
relations:RelationMetadata[]
Relations of the entity, including relations that are coming from the embeddeds of this entity.
relationsWithJoinColumns
relationsWithJoinColumns:RelationMetadata[]
Gets only owner one-to-one and many-to-one relations.
可选schema
schema?:string
Schema name. Used in Postgres and Sql Server.
synchronize
synchronize:boolean
Indicates if schema will be synchronized for this entity or not.
tableMetadataArgs
tableMetadataArgs:TableMetadataArgs
Metadata arguments used to build this entity metadata.
tableName
tableName:string
Entity table name in the database.
This is final table name of the entity.
This name already passed naming strategy, and generated based on
multiple criteria, including user table name and global table prefix.
tableNameWithoutPrefix
tableNameWithoutPrefix:string
Gets the table name without global table prefix.
When querying table you need a table name with prefix, but in some scenarios,
for example when you want to name a junction table that contains names of two other tables,
you may want a table name without prefix.
tablePath
tablePath:string
Entity table path. Contains database name, schema name and table name.
E.g. myDB.mySchema.myTable
tableType
tableType:TableType
Table type. Tables can be closure, junction, etc.
target
target:string|Function
Target class to which this entity metadata is bind.
Note, that when using table inheritance patterns target can be different rather then table's target.
For virtual tables which lack of real entity (like junction tables) target is equal to their table name.
targetName
targetName:string
Gets the name of the target.
可选treeChildrenRelation
treeChildrenRelation?:RelationMetadata
Tree children relation. Used only in tree-tables.
可选treeLevelColumn
treeLevelColumn?:ColumnMetadata
Special column that stores tree level in tree entities.
可选treeOptions
treeOptions?:ClosureTreeOptions
Indicates if this entity is a tree, what options of tree it has.
可选treeParentRelation
treeParentRelation?:RelationMetadata
Tree parent relation. Used only in tree-tables.
可选treeType
treeType?:TreeType
Indicates if this entity is a tree, what type of tree it is.
uniques
uniques:UniqueMetadata[]
Entity's unique metadatas.
可选updateDateColumn
updateDateColumn?:ColumnMetadata
Gets entity column which contains an update date value.
可选versionColumn
versionColumn?:ColumnMetadata
Gets entity column which contains an entity version.
可选withoutRowid
withoutRowid?:boolean
Enables Sqlite "WITHOUT ROWID" modifier for the "CREATE TABLE" statement
Creates a special object - all columns and relations of the object (plus columns and relations from embeds)
in a special format - { propertyName: propertyName }.
example: Post{ id: number, name: string, counterEmbed: { count: number }, category: Category }.
This method will create following object:
{ id: "id", counterEmbed: { count: "counterEmbed.count" }, category: "category" }
Ensures that given object is an entity id map.
If given id is an object then it means its already id map.
If given id isn't an object then it means its a value of the id column
and it creates a new id map with this value and name of the primary column.
Gets primary keys of the entity and returns them in a literal object.
For example, for Post{ id: 1, title: "hello" } where id is primary it will return { id: 1 }
For multiple primary keys it returns multiple keys in object.
For primary keys inside embeds it returns complex object literal with keys in them.
Creates a "mixed id map".
If entity has multiple primary keys (ids) then it will return just regular id map, like what getEntityIdMap returns.
But if entity has a single primary key then it will return just value of the id column of the entity, just value.
This is called mixed id map.
Checks if entity has any column which rely on returning data,
e.g. columns with auto generated value, DEFAULT values considered as dependant of returning data.
For example, if we need to have RETURNING after INSERT (or we need returned id for DBs not supporting RETURNING),
it means we cannot execute bulk inserts in some cases.
Checks if given entity / object contains ALL primary keys entity must have.
Returns true if it contains all of them, false if at least one of them is not defined.
Contains all entity metadata.