Options
All
  • Public
  • Public/Protected
  • All
Menu

Contains all entity metadata.

Hierarchy

  • EntityMetadata

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

afterInsertListeners

afterInsertListeners: EntityListenerMetadata[] = []

Listener metadatas with "AFTER INSERT" type.

afterLoadListeners

afterLoadListeners: EntityListenerMetadata[] = []

Listener metadatas with "AFTER LOAD" type.

afterRemoveListeners

afterRemoveListeners: EntityListenerMetadata[] = []

Listener metadatas with "AFTER REMOVE" type.

afterUpdateListeners

afterUpdateListeners: EntityListenerMetadata[] = []

Listener metadatas with "AFTER UPDATE" type.

allEmbeddeds

allEmbeddeds: EmbeddedMetadata[] = []

All embeddeds - embeddeds from this entity metadata and from all child embeddeds, etc.

ancestorColumns

ancestorColumns: ColumnMetadata[] = []

Ancestor columns used only in closure junction tables.

beforeInsertListeners

beforeInsertListeners: EntityListenerMetadata[] = []

Listener metadatas with "AFTER INSERT" type.

beforeRemoveListeners

beforeRemoveListeners: EntityListenerMetadata[] = []

Listener metadatas with "AFTER REMOVE" type.

beforeUpdateListeners

beforeUpdateListeners: EntityListenerMetadata[] = []

Listener metadatas with "AFTER UPDATE" type.

checks

checks: CheckMetadata[] = []

Entity's check metadatas.

childEntityMetadatas

childEntityMetadatas: EntityMetadata[] = []

Children entity metadatas. Used in inheritance patterns.

closureJunctionTable

closureJunctionTable: EntityMetadata

If entity's table is a closure-typed table, then this entity will have a closure junction table metadata.

columns

columns: ColumnMetadata[] = []

Columns of the entity, including columns that are coming from the embeddeds of this entity.

connection

connection: Connection

Connection where this entity metadata is created.

Optional createDateColumn

createDateColumn: ColumnMetadata

Gets entity column which contains a create date value.

Optional database

database: undefined | string

Database name.

descendantColumns

descendantColumns: ColumnMetadata[] = []

Descendant columns used only in closure junction tables.

Optional discriminatorColumn

discriminatorColumn: ColumnMetadata

Gets the discriminator column used to store entity identificator in single-table inheritance tables.

Optional discriminatorValue

discriminatorValue: undefined | string

If this entity metadata is a child table of some table, it should have a discriminator value. Used to store a value in a discriminator column.

eagerRelations

eagerRelations: RelationMetadata[] = []

List of eager relations this metadata has.

embeddeds

embeddeds: EmbeddedMetadata[] = []

Entity's embedded metadatas.

Optional engine

engine: undefined | string

Table's database engine type (like "InnoDB", "MyISAM", etc).

foreignKeys

foreignKeys: ForeignKeyMetadata[] = []

Entity's foreign key metadatas.

generatedColumns

generatedColumns: ColumnMetadata[] = []

Gets the column with generated flag.

Optional givenTableName

givenTableName: undefined | string

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 = false

Checks if entity's table has multiple primary columns.

hasNonNullableRelations

hasNonNullableRelations: boolean = false

Checks if there any non-nullable column exist in this entity.

hasUUIDGeneratedColumns

hasUUIDGeneratedColumns: boolean = false

Indicates if this entity metadata has uuid generated columns.

indices

indices: IndexMetadata[] = []

Entity's index metadatas.

Optional inheritancePattern

inheritancePattern: undefined | "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.

isClosureJunction

isClosureJunction: boolean = false

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 = false

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.

Optional 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.

Optional nestedSetLeftColumn

nestedSetLeftColumn: ColumnMetadata

Nested set's left value column. Used only in tree entities with nested set pattern applied.

Optional 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.

Optional objectIdColumn

objectIdColumn: ColumnMetadata

Gets the object id column used with mongodb database.

oneToManyRelations

oneToManyRelations: RelationMetadata[] = []

Gets only one-to-many relations of the entity.

oneToOneRelations

oneToOneRelations: RelationMetadata[] = []

Gets only one-to-one relations of the entity.

Optional orderBy

Specifies a default order by used for queries from this table when no explicit order by is specified.

ownColumns

ownColumns: ColumnMetadata[] = []

Entity's column metadatas defined by user.

ownIndices

ownIndices: IndexMetadata[] = []

Entity's own indices.

ownListeners

ownListeners: EntityListenerMetadata[] = []

Entity's own listener metadatas.

ownRelations

ownRelations: RelationMetadata[] = []

Entity's relation metadatas.

ownerColumns

ownerColumns: ColumnMetadata[] = []

In the case if this entity metadata is junction table's entity metadata, this will contain all referenced columns of owner entity.

ownerManyToManyRelations

ownerManyToManyRelations: RelationMetadata[] = []

Gets only owner many-to-many relations of the entity.

ownerOneToOneRelations

ownerOneToOneRelations: RelationMetadata[] = []

Gets only owner one-to-one relations of the entity.

parentClosureEntityMetadata

parentClosureEntityMetadata: EntityMetadata

If this is entity metadata for a junction closure table then its owner closure table metadata will be set here.

parentEntityMetadata

parentEntityMetadata: EntityMetadata

Parent's entity metadata. Used in inheritance patterns.

primaryColumns

primaryColumns: ColumnMetadata[] = []

Gets the primary columns.

propertiesMap

propertiesMap: ObjectLiteral

Map of columns and relations of the entity.

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.

Optional schema

schema: undefined | string

Schema name. Used in Postgres and Sql Server.

Optional schemaPath

schemaPath: undefined | string

Entity schema path. Contains database name and schema name. E.g. myDB.mySchema

synchronize

synchronize: boolean = true

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 = "regular"

Table type. Tables can be abstract, closure, junction, embedded, etc.

target

target: Function | string

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.

Optional treeChildrenRelation

treeChildrenRelation: RelationMetadata

Tree children relation. Used only in tree-tables.

Optional treeLevelColumn

treeLevelColumn: ColumnMetadata

Special column that stores tree level in tree entities.

Optional treeParentRelation

treeParentRelation: RelationMetadata

Tree parent relation. Used only in tree-tables.

Optional treeType

treeType: TreeType

Indicates if this entity is a tree, what type of tree it is.

uniques

uniques: UniqueMetadata[] = []

Entity's unique metadatas.

Optional updateDateColumn

updateDateColumn: ColumnMetadata

Gets entity column which contains an update date value.

Optional versionColumn

versionColumn: ColumnMetadata

Gets entity column which contains an entity version.

Methods

build

  • build(): void

Protected buildSchemaPath

  • buildSchemaPath(): string | undefined

Protected buildTablePath

  • buildTablePath(): string

compareEntities

create

createPropertiesMap

  • createPropertiesMap(): object
  • 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" }

    Returns object

    • [name: string]: string | any

ensureEntityIdMap

  • 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.

    Parameters

    • id: any

    Returns ObjectLiteral

extractRelationValuesFromEntity

findColumnWithDatabaseName

  • findColumnWithDatabaseName(databaseName: string): ColumnMetadata | undefined

findColumnWithPropertyName

  • findColumnWithPropertyName(propertyName: string): ColumnMetadata | undefined

findColumnWithPropertyPath

  • findColumnWithPropertyPath(propertyPath: string): ColumnMetadata | undefined

findColumnsWithPropertyPath

  • Finds columns with a given property path. Property path can match a relation, and relations can contain multiple columns.

    Parameters

    • propertyPath: string

    Returns ColumnMetadata[]

findEmbeddedWithPropertyPath

  • findEmbeddedWithPropertyPath(propertyPath: string): EmbeddedMetadata | undefined

findRelationWithPropertyPath

  • findRelationWithPropertyPath(propertyPath: string): RelationMetadata | undefined

getEntityIdMap

  • 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.

    Parameters

    Returns ObjectLiteral | undefined

getEntityIdMixedMap

  • 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.

    Parameters

    Returns ObjectLiteral | undefined

hasAllPrimaryKeys

  • 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.

    Parameters

    Returns boolean

hasEmbeddedWithPropertyPath

  • hasEmbeddedWithPropertyPath(propertyPath: string): boolean
  • Checks if there is an embedded with a given property path.

    Parameters

    • propertyPath: string

    Returns boolean

hasId

registerColumn

Static compareIds

Static createPropertyPath

Static difference

Static getValueMap

Generated using TypeDoc