Options
All
  • Public
  • Public/Protected
  • All
Menu

Subject is a subject of persistence. It holds information about each entity that needs to be persisted:

  • what entity should be persisted
  • what is database representation of the persisted entity
  • what entity metadata of the persisted entity
  • what is allowed to with persisted entity (insert/update/remove)

Having this collection of subjects we can perform database queries.

Hierarchy

  • Subject

Index

Constructors

constructor

  • new Subject(options: object): Subject

Properties

canBeInserted

canBeInserted: boolean = false

Indicates if this subject can be inserted into the database. This means that this subject either is newly persisted, either can be inserted by cascades.

canBeUpdated

canBeUpdated: boolean = false

Indicates if this subject can be updated in the database. This means that this subject either was persisted, either can be updated by cascades.

changeMaps

changeMaps: SubjectChangeMap[] = []

Changes needs to be applied in the database for the given subject.

Optional databaseEntity

databaseEntity: ObjectLiteral

Database entity. THIS IS NOT RAW ENTITY DATA, its a real entity.

Optional entity

Gets entity sent to the persistence (e.g. changed entity). If entity is not set then this subject is created only for the entity loaded from the database, or this subject is used for the junction operation (junction operations are relying only on identifier).

entityWithFulfilledIds

entityWithFulfilledIds: ObjectLiteral | undefined = undefined

Copy of entity but with relational ids fulfilled.

Optional generatedMap

generatedMap: ObjectLiteral

Generated values returned by a database (for example generated id or default values). Used in insert and update operations. Has entity-like structure (not just column database name and values).

identifier

identifier: ObjectLiteral | undefined = undefined

Subject identifier. This identifier is not limited to table entity primary columns. This can be entity id or ids as well as some unique entity properties, like name or title. Insert / Update / Remove operation will be executed by a given identifier.

Optional insertedValueSet

insertedValueSet: ObjectLiteral

Inserted values with updated values of special and default columns. Has entity-like structure (not just column database name and values).

metadata

metadata: EntityMetadata

Entity metadata of the subject entity.

mustBeRemoved

mustBeRemoved: boolean = false

Indicates if this subject MUST be removed from the database. This means that this subject either was removed, either was removed by cascades.

Optional parentSubject

parentSubject: Subject

If subject was created by cascades this property will contain subject from where this subject was created.

updatedRelationMaps

updatedRelationMaps: object[] = []

Relations updated by the change maps.

Accessors

mustBeInserted

  • get mustBeInserted(): boolean
  • Checks if this subject must be inserted into the database. Subject can be inserted into the database if it is allowed to be inserted (explicitly persisted or by cascades) and if it does not have database entity set.

    Returns boolean

mustBeUpdated

  • get mustBeUpdated(): undefined | true | false
  • Checks if this subject must be updated into the database. Subject can be updated in the database if it is allowed to be updated (explicitly persisted or by cascades) and if it does have differentiated columns or relations.

    Returns undefined | true | false

Methods

createValueSetAndPopChangeMap

  • Creates a value set needs to be inserted / updated in the database. Value set is based on the entity and change maps of the subject. Important note: this method pops data from this subject's change maps.

    Returns ObjectLiteral

Generated using TypeDoc