Skip to main content
Version: 4.5

Class: EntitySchema<T, U>#

core.EntitySchema

Type parameters#

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

Constructors#

constructor#

+ new EntitySchema<T, U>(meta: Omit<Partial<EntityMetadata<T>>, name | properties> & { name: string } | { class: Constructor<T> ; name?: string } & { properties?: { [K in string]-?: object & TypeDef<ExpandProperty<NonNullable<T[K]>>> & ManyToOneOptions<ExpandProperty<NonNullable<T[K]>>, T> | object & TypeDef<ExpandProperty<NonNullable<T[K]>>> & OneToOneOptions<ExpandProperty<NonNullable<T[K]>>, T> | object & TypeDef<ExpandProperty<NonNullable<T[K]>>> & ReferenceOptions<ExpandProperty<NonNullable<T[K]>>, T> & object | object & TypeDef<ExpandProperty<NonNullable<T[K]>>> & ManyToManyOptions<ExpandProperty<NonNullable<T[K]>>, T> | object & TypeDef<ExpandProperty<NonNullable<T[K]>>> & EmbeddedOptions & PropertyOptions<T> | object & EnumOptions<T> | TypeDef<ExpandProperty<NonNullable<T[K]>>> & PropertyOptions<T>} }): EntitySchema<T, U>

Type parameters:#

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

Parameters:#

NameType
metaOmit<Partial<EntityMetadata<T>>, name | properties> & { name: string } | { class: Constructor<T> ; name?: string } & { properties?: { [K in string]-?: object & TypeDef<ExpandProperty<NonNullable<T[K]>>> & ManyToOneOptions<ExpandProperty<NonNullable<T[K]>>, T> | object & TypeDef<ExpandProperty<NonNullable<T[K]>>> & OneToOneOptions<ExpandProperty<NonNullable<T[K]>>, T> | object & TypeDef<ExpandProperty<NonNullable<T[K]>>> & ReferenceOptions<ExpandProperty<NonNullable<T[K]>>, T> & object | object & TypeDef<ExpandProperty<NonNullable<T[K]>>> & ManyToManyOptions<ExpandProperty<NonNullable<T[K]>>, T> | object & TypeDef<ExpandProperty<NonNullable<T[K]>>> & EmbeddedOptions & PropertyOptions<T> | object & EnumOptions<T> | TypeDef<ExpandProperty<NonNullable<T[K]>>> & PropertyOptions<T>} }

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#

• get meta(): EntityMetadata<T>

Returns: EntityMetadata<T>

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


name#

• get name(): EntityName<T>

Returns: EntityName<T>

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

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:119


addEnum#

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

Parameters:#

NameType
namestring & keyof T
type?TypeType
optionsEnumOptions<T>

Returns: void

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


addIndex#

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

Type parameters:#

Name
T

Parameters:#

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

Returns: void

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


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:149


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:134


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:164


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:169


addPrimaryKey#

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

Parameters:#

NameType
namestring & keyof T
typeTypeType
optionsPrimaryKeyOptions<T>

Returns: void

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


addProperty#

addProperty(name: string & keyof T, type?: TypeType, options?: EntityProperty<any> | PropertyOptions<T>): void

Parameters:#

NameType
namestring & keyof T
type?TypeType
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:#

NameType
namestring & keyof T
typeTypeType
optionsSerializedPrimaryKeyOptions<T>

Returns: void

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


addUnique#

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

Type parameters:#

Name
T

Parameters:#

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

Returns: void

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


addVersion#

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

Parameters:#

NameType
namestring & keyof T
typeTypeType
optionsPropertyOptions<T>

Returns: void

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


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:330


init#

init(): EntitySchema<T, U>

internal

Returns: EntitySchema<T, U>

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


initPrimaryKeys#

PrivateinitPrimaryKeys(): void

Returns: void

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


initProperties#

PrivateinitProperties(): void

Returns: void

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


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:310


setClass#

setClass(proto: Constructor<T>): void

Parameters:#

NameType
protoConstructor<T>

Returns: void

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


setCustomRepository#

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

Parameters:#

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

Returns: void

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


setExtends#

setExtends(base: string): void

Parameters:#

NameType
basestring

Returns: void

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


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 Renovate Bot