Skip to main content
Version: 4.4

Class: EntitySchema<T, U>#

core.EntitySchema

Type parameters#

NameTypeDefault
TAnyEntity<T>AnyEntity
UAnyEntity<U> | undefinedundefined

Hierarchy#

  • EntitySchema

Constructors#

constructor#

+ new EntitySchema<T, U>(meta: Metadata<T, U>): EntitySchema<T, U>

Type parameters:#

NameTypeDefault
TAnyEntity<T>AnyEntity<any\>
Uundefined | AnyEntity<U>undefined

Parameters:#

NameType
metaMetadata<T, U>

Returns: EntitySchema<T, U>

Defined in: packages/core/src/metadata/EntitySchema.ts:32

Properties#

_meta#

Private Readonly _meta: EntityMetadata<T>

Defined in: packages/core/src/metadata/EntitySchema.ts:30


initialized#

Private initialized: boolean= false

Defined in: packages/core/src/metadata/EntitySchema.ts:32


internal#

Private internal: boolean= false

Defined in: packages/core/src/metadata/EntitySchema.ts:31

Accessors#

meta#

meta(): EntityMetadata<T>

Returns: EntityMetadata<T>

Defined in: packages/core/src/metadata/EntitySchema.ts:207


name#

name(): EntityName<T>

Returns: EntityName<T>

Defined in: packages/core/src/metadata/EntitySchema.ts:211

Methods#

addEmbedded#

addEmbedded<K>(name: string & keyof T, options: EmbeddedOptions): void

Type parameters:#

NameDefault
Kunknown

Parameters:#

NameType
namestring & keyof T
optionsEmbeddedOptions

Returns: void

Defined in: packages/core/src/metadata/EntitySchema.ts:113


addEnum#

addEnum(name: string & keyof T, type?: string | NumberConstructor | StringConstructor | BooleanConstructor | DateConstructor | ArrayConstructor | Constructor<Type<any, any>>, options?: EnumOptions<T>): void

Parameters:#

NameTypeDefault value
namestring & keyof T-
type?string | NumberConstructor | StringConstructor | BooleanConstructor | DateConstructor | ArrayConstructor | Constructor<Type<any, any>>-
optionsEnumOptions<T>...

Returns: void

Defined in: packages/core/src/metadata/EntitySchema.ts:85


addIndex#

addIndex<T>(options: Required<Pick<IndexOptions<T>, properties>> & { name?: undefined | string ; options?: undefined | Dictionary<any> ; type?: undefined | string }): void

Type parameters:#

Name
T

Parameters:#

NameType
optionsRequired<Pick<IndexOptions<T>, properties>> & { name?: undefined | string ; options?: undefined | Dictionary<any> ; type?: undefined | string }

Returns: void

Defined in: packages/core/src/metadata/EntitySchema.ts:179


addManyToMany#

addManyToMany<K>(name: string & keyof T, type: TypeType, options: ManyToManyOptions<K, T>): void

Type parameters:#

NameDefault
Kunknown

Parameters:#

NameType
namestring & keyof T
typeTypeType
optionsManyToManyOptions<K, T>

Returns: void

Defined in: packages/core/src/metadata/EntitySchema.ts:138


addManyToOne#

addManyToOne<K>(name: string & keyof T, type: TypeType, options: ManyToOneOptions<K, T>): void

Type parameters:#

NameDefault
Kunknown

Parameters:#

NameType
namestring & keyof T
typeTypeType
optionsManyToOneOptions<K, T>

Returns: void

Defined in: packages/core/src/metadata/EntitySchema.ts:123


addOneToMany#

addOneToMany<K>(name: string & keyof T, type: TypeType, options: OneToManyOptions<K, T>): void

Type parameters:#

NameDefault
Kunknown

Parameters:#

NameType
namestring & keyof T
typeTypeType
optionsOneToManyOptions<K, T>

Returns: void

Defined in: packages/core/src/metadata/EntitySchema.ts:153


addOneToOne#

addOneToOne<K>(name: string & keyof T, type: TypeType, options: OneToOneOptions<K, T>): void

Type parameters:#

NameDefault
Kunknown

Parameters:#

NameType
namestring & keyof T
typeTypeType
optionsOneToOneOptions<K, T>

Returns: void

Defined in: packages/core/src/metadata/EntitySchema.ts:158


addPrimaryKey#

addPrimaryKey(name: string & keyof T, type: TypeType, options?: PrimaryKeyOptions<T>): void

Parameters:#

NameTypeDefault value
namestring & keyof T-
typeTypeType-
optionsPrimaryKeyOptions<T>...

Returns: void

Defined in: packages/core/src/metadata/EntitySchema.ts:104


addProperty#

addProperty(name: string & keyof T, type?: string | NumberConstructor | StringConstructor | BooleanConstructor | DateConstructor | ArrayConstructor | Constructor<Type<any, any>>, options?: EntityProperty<any> | PropertyOptions<T>): void

Parameters:#

NameTypeDefault value
namestring & keyof T-
type?string | NumberConstructor | StringConstructor | BooleanConstructor | DateConstructor | ArrayConstructor | Constructor<Type<any, any>>-
optionsEntityProperty<any> | PropertyOptions<T>...

Returns: void

Defined in: packages/core/src/metadata/EntitySchema.ts:53


addSerializedPrimaryKey#

addSerializedPrimaryKey(name: string & keyof T, type: TypeType, options?: SerializedPrimaryKeyOptions<T>): void

Parameters:#

NameTypeDefault value
namestring & keyof T-
typeTypeType-
optionsSerializedPrimaryKeyOptions<T>...

Returns: void

Defined in: packages/core/src/metadata/EntitySchema.ts:108


addUnique#

addUnique<T>(options: Required<Pick<UniqueOptions<T>, properties>> & { name?: undefined | string ; options?: undefined | Dictionary<any> }): void

Type parameters:#

Name
T

Parameters:#

NameType
optionsRequired<Pick<UniqueOptions<T>, properties>> & { name?: undefined | string ; options?: undefined | Dictionary<any> }

Returns: void

Defined in: packages/core/src/metadata/EntitySchema.ts:183


addVersion#

addVersion(name: string & keyof T, type: TypeType, options?: PropertyOptions<T>): void

Parameters:#

NameTypeDefault value
namestring & keyof T-
typeTypeType-
optionsPropertyOptions<T>...

Returns: void

Defined in: packages/core/src/metadata/EntitySchema.ts:100


createProperty#

PrivatecreateProperty<T>(reference: ReferenceType, options: EntityProperty<any> | PropertyOptions<T>): EntityProperty<T>

Type parameters:#

Name
T

Parameters:#

NameType
referenceReferenceType
optionsEntityProperty<any> | PropertyOptions<T>

Returns: EntityProperty<T>

Defined in: packages/core/src/metadata/EntitySchema.ts:319


init#

init(): EntitySchema<T, U>

internal

Returns: EntitySchema<T, U>

Defined in: packages/core/src/metadata/EntitySchema.ts:218


initPrimaryKeys#

PrivateinitPrimaryKeys(): void

Returns: void

Defined in: packages/core/src/metadata/EntitySchema.ts:279


initProperties#

PrivateinitProperties(): void

Returns: void

Defined in: packages/core/src/metadata/EntitySchema.ts:243


normalizeType#

PrivatenormalizeType(options: EntityProperty<any> | PropertyOptions<T>, type?: any): any

Parameters:#

NameType
optionsEntityProperty<any> | PropertyOptions<T>
type?any

Returns: any

Defined in: packages/core/src/metadata/EntitySchema.ts:299


setClass#

setClass(proto: Constructor<T>): void

Parameters:#

NameType
protoConstructor<T>

Returns: void

Defined in: packages/core/src/metadata/EntitySchema.ts:195


setCustomRepository#

setCustomRepository(repository: () => Constructor<EntityRepository<T>>): void

Parameters:#

NameType
repository() => Constructor<EntityRepository<T>>

Returns: void

Defined in: packages/core/src/metadata/EntitySchema.ts:187


setExtends#

setExtends(base: string): void

Parameters:#

NameType
basestring

Returns: void

Defined in: packages/core/src/metadata/EntitySchema.ts:191


fromMetadata#

StaticfromMetadata<T, U>(meta: EntityMetadata<T> | DeepPartial<EntityMetadata<T>>): EntitySchema<T, U>

Type parameters:#

NameTypeDefault
TAnyEntity<T>AnyEntity<any\>
Uundefined | AnyEntity<U>undefined

Parameters:#

NameType
metaEntityMetadata<T> | DeepPartial<EntityMetadata<T>>

Returns: EntitySchema<T, U>

Defined in: packages/core/src/metadata/EntitySchema.ts:46

Last updated on by Martin Adámek