EntitySchemaWithMeta <TName, TTableName, TEntity, TBase, TProperties, TClass>
Hierarchy
- EntitySchema<TEntity, TBase, TClass>
- EntitySchemaWithMeta
Index
Properties
readonlyname
Returns the entity class name.
readonlyproperties
readonlytableName
Returns the database table name.
Accessors
inheritedclass
Returns Class
inheritedmeta
Returns the underlying EntityMetadata.
Returns EntityMetadata<Entity, Class>
Methods
inheritedaddEmbedded
Adds an embedded property to the entity schema.
Parameters
name: EntityKey<TEntity>
options: EmbeddedOptions<TEntity, Target>
Returns void
inheritedaddEnum
Adds an enum property to the entity schema.
Parameters
name: EntityKey<TEntity>
optionaltype: TypeType
options: EnumOptions<TEntity> = {}
Returns void
inheritedaddHook
Adds a lifecycle hook handler to the entity schema. This method allows registering hooks after the entity is defined, which can be useful for avoiding circular type references.
Parameters
event: EventType | onInit | onLoad | beforeCreate | afterCreate | beforeUpdate | afterUpdate | beforeUpsert | afterUpsert | beforeDelete | afterDelete | beforeFlush | onFlush | afterFlush | beforeTransactionStart | afterTransactionStart | beforeTransactionCommit | afterTransactionCommit | beforeTransactionRollback | afterTransactionRollback
handler: (args) => void | Promise<void>
Returns this
inheritedaddIndex
Adds an index definition to the entity schema.
Parameters
options: IndexOptions<TEntity, Key>
Returns void
inheritedaddManyToMany
Adds a many-to-many relation to the entity schema.
Parameters
name: EntityKey<TEntity>
type: TypeType
options: ManyToManyOptions<TEntity, Target>
Returns void
inheritedaddManyToOne
Adds a many-to-one relation to the entity schema.
Parameters
name: EntityKey<TEntity>
type: TypeType
options: ManyToOneOptions<TEntity, Target>
Returns void
inheritedaddOneToMany
Adds a one-to-many relation to the entity schema.
Parameters
name: EntityKey<TEntity>
type: TypeType
options: OneToManyOptions<TEntity, Target>
Returns void
inheritedaddOneToOne
Adds a one-to-one relation to the entity schema.
Parameters
name: EntityKey<TEntity>
type: TypeType
options: OneToOneOptions<TEntity, Target>
Returns void
inheritedaddPrimaryKey
Adds a primary key property to the entity schema.
Parameters
name: EntityKey<TEntity>
type: TypeType
options: PrimaryKeyOptions<TEntity> = {}
Returns void
inheritedaddProperty
Adds a scalar property to the entity schema.
Parameters
name: EntityKey<TEntity>
optionaltype: TypeType
options: PropertyOptions<TEntity> | EntityProperty<TEntity, any> = {}
Returns void
inheritedaddSerializedPrimaryKey
Adds a serialized primary key property (e.g. for MongoDB ObjectId).
Parameters
name: EntityKey<TEntity>
type: TypeType
options: SerializedPrimaryKeyOptions<TEntity> = {}
Returns void
inheritedaddUnique
Adds a unique constraint definition to the entity schema.
Parameters
options: UniqueOptions<TEntity, Key>
Returns void
inheritedaddVersion
Adds a version property for optimistic locking.
Parameters
name: EntityKey<TEntity>
type: TypeType
options: PropertyOptions<TEntity> = {}
Returns void
inheritednew
Parameters
rest...params: ConstructorParameters<TClass>
Returns TEntity
inheritedsetClass
Sets or replaces the entity class associated with this schema.
Parameters
cls: TClass
Returns void
inheritedsetCustomRepository
Sets a custom repository class for this entity.
Parameters
repository: () => Constructor
Returns void
inheritedsetExtends
Sets the base entity that this schema extends.
Parameters
base: EntityName
Returns void
Extended
EntitySchemainterface that carries additional type-level metadata (entity name, properties, table name). Returned bydefineEntity()to provide strong type inference without explicit generics.