Skip to main content
Version: 5.3

@mikro-orm/core

Index

Classes

Enumerations

Functions

Interfaces

Type Aliases

Variables

Type Aliases

AnyEntity

AnyEntity<T>: Partial<T> & { [EntityRepositoryType]?: unknown; [PrimaryKeyType]?: unknown; __helper?: IWrappedEntityInternal<T, keyof T>; __meta?: EntityMetadata<T>; __platform?: Platform }

Type parameters

  • T = any

Cast

Cast<T, R>: T extends R ? T : R

Type parameters

  • T
  • R

CheckCallback

CheckCallback<T>: (columns: Record<keyof T, string>) => string

Type parameters

  • T

Type declaration

    • (columns: Record<keyof T, string>): string
    • Parameters

      • columns: Record<keyof T, string>

      Returns string

CheckOptions

CheckOptions<T>: CheckConstraint<T>

Type parameters

  • T = any

ConnectionType

ConnectionType: read | write

Constructor

Constructor<T>: new (...args: any[]) => T

Type parameters

  • T = unknown

Type declaration

    • new (...args: any[]): T
    • Parameters

      • rest...args: any[]

      Returns T

DeepPartial

DeepPartial<T>: T & { [ P in keyof T ]?: T[P] extends infer U[] ? DeepPartial<U>[] : T[P] extends Readonly<infer U>[] ? Readonly<DeepPartial<U>>[] : DeepPartial<T[P]> }

Type parameters

  • T

Dictionary

Dictionary<T>: {}

Type parameters

  • T = any

Type declaration

  • [k string]: T

EmbeddableOptions

EmbeddableOptions: { abstract?: boolean; discriminatorColumn?: string; discriminatorMap?: Dictionary<string>; discriminatorValue?: number | string }

Type declaration

  • optionalabstract?: boolean
  • optionaldiscriminatorColumn?: string
  • optionaldiscriminatorMap?: Dictionary<string>
  • optionaldiscriminatorValue?: number | string

EmbeddedOptions

EmbeddedOptions: { array?: boolean; entity?: string | () => AnyEntity | AnyEntity[]; hidden?: boolean; nullable?: boolean; object?: boolean; prefix?: string | boolean; serializedName?: string; serializer?: (value: any) => any; type?: string }

Type declaration

  • optionalarray?: boolean
  • optionalentity?: string | () => AnyEntity | AnyEntity[]
  • optionalhidden?: boolean
  • optionalnullable?: boolean
  • optionalobject?: boolean
  • optionalprefix?: string | boolean
  • optionalserializedName?: string
  • optionalserializer?: (value: any) => any
      • (value: any): any
      • Parameters

        • value: any

        Returns any

  • optionaltype?: string

EntityClass

EntityClass<T>: Function & { prototype: T }

Type parameters

EntityClassGroup

EntityClassGroup<T>: { entity: EntityClass<T>; schema: EntityMetadata<T> | EntitySchema<T> }

Type parameters

Type declaration

EntityDTO

EntityDTO<T>: { [ K in keyof T as ExcludeFunctions<T, K> ]: EntityDTOProp<T[K]> }

Type parameters

  • T

EntityData

EntityData<T>: { [ K in keyof T as ExcludeFunctions<T, K> ]?: EntityDataItem<T[K]> }

Type parameters

  • T

EntityDictionary

EntityDictionary<T>: EntityData<T> & Dictionary

Type parameters

  • T

EntityField

EntityField<T, P>: keyof T | * | AutoPath<T, P, *> | FieldsMap<T, P>

Type parameters

  • T
  • P: string = never

EntityLoaderOptions

EntityLoaderOptions<T, P>: { connectionType?: ConnectionType; convertCustomTypes?: boolean; fields?: readonly EntityField<T, P>[]; filters?: Dictionary<boolean | Dictionary> | string[] | boolean; ignoreLazyScalarProperties?: boolean; lockMode?: Exclude<LockMode, LockMode.OPTIMISTIC>; lookup?: boolean; orderBy?: QueryOrderMap<T> | QueryOrderMap<T>[]; populateWhere?: PopulateHint; refresh?: boolean; schema?: string; strategy?: LoadStrategy; validate?: boolean; where?: FilterQuery<T> }

Type parameters

  • T
  • P: string = never

Type declaration

EntityName

EntityName<T>: string | EntityClass<T> | EntitySchema<T, any>

Type parameters

EntityOptions

EntityOptions<T>: { abstract?: boolean; collection?: string; comment?: string; customRepository?: () => Constructor; discriminatorColumn?: string; discriminatorMap?: Dictionary<string>; discriminatorValue?: number | string; expression?: string | (em: any, where: FilterQuery<T>, options: FindOptions<T, any>) => object; readonly?: boolean; schema?: string; tableName?: string; virtual?: boolean }

Type parameters

  • T

Type declaration

  • optionalabstract?: boolean
  • optionalcollection?: string
  • optionalcomment?: string
  • optionalcustomRepository?: () => Constructor
  • optionaldiscriminatorColumn?: string
  • optionaldiscriminatorMap?: Dictionary<string>
  • optionaldiscriminatorValue?: number | string
  • optionalexpression?: string | (em: any, where: FilterQuery<T>, options: FindOptions<T, any>) => object
  • optionalreadonly?: boolean
  • optionalschema?: string
  • optionaltableName?: string
  • optionalvirtual?: boolean

FilterQuery

FilterQuery<T>: ObjectQuery<T> | NonNullable<ExpandScalar<Primary<T>>> | T | FilterQuery<T>[]

Type parameters

  • T

GetRepository

GetRepository<T, U>: T[typeof EntityRepositoryType] extends EntityRepository<T> | undefined ? NonNullable<T[typeof EntityRepositoryType]> : U

Type parameters

IPrimaryKey

IPrimaryKey<T>: T

Type parameters

  • T: IPrimaryKeyValue = IPrimaryKeyValue

IdentifiedReference

IdentifiedReference<T, PK>: true extends IsUnknown<PK> ? Reference<T> : { [ K in Cast<PK, keyof T> ]: T[K] } & Reference<T>

Type parameters

IsUnknown

IsUnknown<T>: T extends unknown ? unknown extends T ? true : never : never

Type parameters

  • T

Loaded

Loaded<T, L>: T & { [ K in keyof T ]: K extends Prefix<L> ? LoadedLoadable<T[K], Loaded<ExtractType<T[K]>, Suffix<L>>> : T[K] }

Type parameters

  • T
  • L: string = never

LoggerNamespace

LoggerNamespace: query | query-params | schema | discovery | info

MigrationsOptions

MigrationsOptions: { allOrNothing?: boolean; disableForeignKeys?: boolean; dropTables?: boolean; emit?: js | ts; fileName?: (timestamp: string) => string; generator?: Constructor<IMigrationGenerator>; glob?: string; migrationsList?: MigrationObject[]; path?: string; pathTs?: string; safe?: boolean; snapshot?: boolean; tableName?: string; transactional?: boolean }

Type declaration

  • optionalallOrNothing?: boolean
  • optionaldisableForeignKeys?: boolean
  • optionaldropTables?: boolean
  • optionalemit?: js | ts
  • optionalfileName?: (timestamp: string) => string
      • (timestamp: string): string
      • Parameters

        • timestamp: string

        Returns string

  • optionalgenerator?: Constructor<IMigrationGenerator>
  • optionalglob?: string
  • optionalmigrationsList?: MigrationObject[]
  • optionalpath?: string
  • optionalpathTs?: string
  • optionalsafe?: boolean
  • optionalsnapshot?: boolean
  • optionaltableName?: string
  • optionaltransactional?: boolean

New

New<T, P>: Loaded<T, P>

Type parameters

ObjectQuery

ObjectQuery<T>: ExpandObject<T> & OperatorMap<T>

Type parameters

  • T

OneToManyOptions

OneToManyOptions<T, O>: ReferenceOptions<T, O> & { entity?: string | () => EntityName<T>; inverseJoinColumn?: string; inverseJoinColumns?: string[]; joinColumn?: string; joinColumns?: string[]; mappedBy: (string & keyof T) | (e: T) => any; orderBy?: QueryOrderMap<T> | QueryOrderMap<T>[]; orphanRemoval?: boolean; referenceColumnName?: string }

Type parameters

  • T
  • O

Options

Options<D>: Pick<MikroORMOptions<D>, Exclude<keyof MikroORMOptions<D>, keyof typeof Configuration.DEFAULTS>> & Partial<MikroORMOptions<D>>

Type parameters

Populate

Populate<T, P>: readonly AutoPath<T, P>[] | boolean

Type parameters

  • T
  • P: string = never

PopulateOptions

PopulateOptions<T>: { all?: boolean; children?: PopulateOptions<T[keyof T]>[]; field: string; strategy?: LoadStrategy }

Type parameters

  • T

Type declaration

Primary

Primary<T>: T extends { [PrimaryKeyType]?: infer PK } ? ReadonlyPrimary<PK> : T extends { _id?: infer PK } ? ReadonlyPrimary<PK> | string : T extends { uuid?: infer PK } ? ReadonlyPrimary<PK> : T extends { id?: infer PK } ? ReadonlyPrimary<PK> : never

Type parameters

  • T

PrimaryProperty

PrimaryProperty<T>: T extends { [PrimaryKeyProp]?: infer PK } ? PK : T extends { _id?: any } ? _id | string : T extends { uuid?: any } ? uuid : T extends { id?: any } ? id : never

Type parameters

  • T

PropertyOptions

PropertyOptions<T>: { autoincrement?: boolean; check?: string | CheckCallback<T>; columnType?: ColumnType | AnyString; comment?: string; concurrencyCheck?: boolean; customOrder?: string[] | number[] | boolean[]; customType?: Type<any>; default?: string | string[] | number | number[] | boolean | null; defaultRaw?: string; extra?: string; fieldName?: string; fieldNames?: string[]; formula?: string | (alias: string) => string; getter?: boolean; hidden?: boolean; index?: boolean | string; lazy?: boolean; length?: number; name?: string; nullable?: boolean; onCreate?: (entity: T) => any; onUpdate?: (entity: T) => any; persist?: boolean; precision?: number; primary?: boolean; scale?: number; serializedName?: string; serializedPrimaryKey?: boolean; serializer?: (value: any) => any; setter?: boolean; trackChanges?: boolean; type?: keyof typeof types | ObjectId | Date | Constructor<AnyEntity> | Constructor<Type<any>> | Type<any> | () => unknown | ColumnType | AnyString; unique?: boolean | string; unsigned?: boolean; version?: boolean }

Type parameters

  • T

Type declaration

  • optionalautoincrement?: boolean
  • optionalcheck?: string | CheckCallback<T>
  • optionalcolumnType?: ColumnType | AnyString
  • optionalcomment?: string
  • optionalconcurrencyCheck?: boolean
  • optionalcustomOrder?: string[] | number[] | boolean[]
  • optionalcustomType?: Type<any>
  • optionaldefault?: string | string[] | number | number[] | boolean | null
  • optionaldefaultRaw?: string
  • optionalextra?: string

    mysql only

  • optionalfieldName?: string
  • optionalfieldNames?: string[]
  • optionalformula?: string | (alias: string) => string
  • optionalgetter?: boolean
  • optionalhidden?: boolean
  • optionalindex?: boolean | string
  • optionallazy?: boolean
  • optionallength?: number
  • optionalname?: string
  • optionalnullable?: boolean
  • optionalonCreate?: (entity: T) => any
      • (entity: T): any
      • Parameters

        • entity: T

        Returns any

  • optionalonUpdate?: (entity: T) => any
      • (entity: T): any
      • Parameters

        • entity: T

        Returns any

  • optionalpersist?: boolean
  • optionalprecision?: number
  • optionalprimary?: boolean
  • optionalscale?: number
  • optionalserializedName?: string
  • optionalserializedPrimaryKey?: boolean
  • optionalserializer?: (value: any) => any
      • (value: any): any
      • Parameters

        • value: any

        Returns any

  • optionalsetter?: boolean
  • optionaltrackChanges?: boolean
  • optionaltype?: keyof typeof types | ObjectId | Date | Constructor<AnyEntity> | Constructor<Type<any>> | Type<any> | () => unknown | ColumnType | AnyString
  • optionalunique?: boolean | string
  • optionalunsigned?: boolean
  • optionalversion?: boolean

QBFilterQuery

QBFilterQuery<T>: FilterQuery<T> | Dictionary

Type parameters

  • T = any

QBQueryOrderMap

QBQueryOrderMap<T>: QueryOrderMap<T> | Dictionary

Type parameters

  • T

QueryOrderKeys

QueryOrderKeys<T>: QueryOrderKeysFlat | QueryOrderMap<T>

Type parameters

  • T

QueryOrderKeysFlat

QueryOrderKeysFlat: QueryOrder | QueryOrderNumeric | keyof typeof QueryOrder

QueryOrderMap

QueryOrderMap<T>: { [ K in keyof T as ExcludeFunctions<T, K> ]?: QueryOrderKeys<ExpandProperty<T[K]>> }

Type parameters

  • T

RequiredEntityData

RequiredEntityData<T>: EntityData<T> & { [ K in keyof T as RequiredKeys<T, K> ]: T[K] | EntityDataProp<T[K]> }

Type parameters

  • T

SeederOptions

SeederOptions: { defaultSeeder?: string; emit?: js | ts; fileName?: (className: string) => string; glob?: string; path?: string; pathTs?: string }

Type declaration

  • optionaldefaultSeeder?: string
  • optionalemit?: js | ts
  • optionalfileName?: (className: string) => string
      • (className: string): string
      • Parameters

        • className: string

        Returns string

  • optionalglob?: string
  • optionalpath?: string
  • optionalpathTs?: string

Transaction

Transaction<T>: T

Type parameters

  • T = any

TransactionEventType

TransactionEventType: EventType.beforeTransactionStart | EventType.afterTransactionStart | EventType.beforeTransactionCommit | EventType.afterTransactionCommit | EventType.beforeTransactionRollback | EventType.afterTransactionRollback

Variables

constARRAY_OPERATORS

ARRAY_OPERATORS: string[] = ...

constEntityManagerType

EntityManagerType: typeof EntityManagerType = ...

constEntityRepositoryType

EntityRepositoryType: typeof EntityRepositoryType = ...

constJsonProperty

JsonProperty: typeof JsonProperty = ...

constObjectBindingPattern

ObjectBindingPattern: typeof ObjectBindingPattern = ...

constOptionalProps

OptionalProps: typeof OptionalProps = ...

constPrimaryKeyProp

PrimaryKeyProp: typeof PrimaryKeyProp = ...

constPrimaryKeyType

PrimaryKeyType: typeof PrimaryKeyType = ...

constSCALAR_TYPES

SCALAR_TYPES: string[] = ...

constt

t: { array: typeof ArrayType; bigint: typeof BigIntType; blob: typeof BlobType; boolean: typeof BooleanType; date: typeof DateType; datetime: typeof DateTimeType; decimal: typeof DecimalType; double: typeof DoubleType; enum: typeof EnumType; enumArray: typeof EnumArrayType; float: typeof FloatType; integer: typeof IntegerType; json: typeof JsonType; mediumint: typeof MediumIntType; smallint: typeof SmallIntType; string: typeof StringType; text: typeof TextType; time: typeof TimeType; tinyint: typeof TinyIntType; uuid: typeof UuidType } = types

Type declaration

consttypes

types: { array: typeof ArrayType; bigint: typeof BigIntType; blob: typeof BlobType; boolean: typeof BooleanType; date: typeof DateType; datetime: typeof DateTimeType; decimal: typeof DecimalType; double: typeof DoubleType; enum: typeof EnumType; enumArray: typeof EnumArrayType; float: typeof FloatType; integer: typeof IntegerType; json: typeof JsonType; mediumint: typeof MediumIntType; smallint: typeof SmallIntType; string: typeof StringType; text: typeof TextType; time: typeof TimeType; tinyint: typeof TinyIntType; uuid: typeof UuidType } = ...

Type declaration