Skip to main content
Version: 5.1

@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; type?: string; serializer?: any }

Type declaration

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

    • Parameters

      • value: any

      Returns any

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

  • optionalconvertCustomTypes?: boolean
  • optionalfields?: readonly EntityField<T, P>[]
  • optionalfilters?: Dictionary<boolean | Dictionary> | string[] | boolean
  • optionalignoreLazyScalarProperties?: boolean
  • optionallockMode?: Exclude<LockMode, LockMode.OPTIMISTIC>
  • optionallookup?: boolean
  • optionalorderBy?: QueryOrderMap<T> | QueryOrderMap<T>[]
  • optionalpopulateWhere?: PopulateHint
  • optionalrefresh?: boolean
  • optionalschema?: string
  • optionalstrategy?: LoadStrategy
  • optionalvalidate?: boolean
  • optionalwhere?: FilterQuery<T>

EntityName

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

Type parameters

EntityOptions

EntityOptions<T>: { abstract?: boolean; collection?: string; comment?: string; discriminatorColumn?: string; discriminatorMap?: Dictionary<string>; discriminatorValue?: number | string; readonly?: boolean; schema?: string; tableName?: string; customRepository?: any }

Type parameters

  • T

Type declaration

  • optionalabstract?: boolean
  • optionalcollection?: string
  • optionalcomment?: string
  • optionaldiscriminatorColumn?: string
  • optionaldiscriminatorMap?: Dictionary<string>
  • optionaldiscriminatorValue?: number | string
  • optionalreadonly?: boolean
  • optionalschema?: string
  • optionaltableName?: string
  • customRepository?: function

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 | discovery | info

MigrationsOptions

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

Type declaration

  • optionalallOrNothing?: boolean
  • optionaldisableForeignKeys?: boolean
  • optionaldropTables?: boolean
  • optionalemit?: js | ts
  • optionalgenerator?: Constructor<IMigrationGenerator>
  • optionalglob?: string
  • optionalmigrationsList?: MigrationObject[]
  • optionalpath?: string
  • optionalpathTs?: string
  • optionalsafe?: boolean
  • optionalsnapshot?: boolean
  • optionaltableName?: string
  • optionaltransactional?: boolean
  • fileName?: function
    • fileName(timestamp: string): string

    • Parameters

      • timestamp: string

      Returns string

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?: string; 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; persist?: boolean; precision?: number; primary?: boolean; scale?: number; serializedName?: string; serializedPrimaryKey?: boolean; setter?: boolean; type?: string | number | boolean | bigint | ObjectId | string | unknown | bigint | Date | Constructor<Type<any>> | Type<any>; unique?: boolean | string; unsigned?: boolean; version?: boolean; onCreate?: any; onUpdate?: any; serializer?: any }

Type parameters

  • T

Type declaration

  • optionalautoincrement?: boolean
  • optionalcheck?: string | CheckCallback<T>
  • optionalcolumnType?: string
  • 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
  • optionalpersist?: boolean
  • optionalprecision?: number
  • optionalprimary?: boolean
  • optionalscale?: number
  • optionalserializedName?: string
  • optionalserializedPrimaryKey?: boolean
  • optionalsetter?: boolean
  • optionaltype?: string | number | boolean | bigint | ObjectId | string | unknown | bigint | Date | Constructor<Type<any>> | Type<any>
  • optionalunique?: boolean | string
  • optionalunsigned?: boolean
  • optionalversion?: boolean
  • onCreate?: function
    • onCreate(entity: T): any

    • Parameters

      • entity: T

      Returns any

  • onUpdate?: function
    • onUpdate(entity: T): any

    • Parameters

      • entity: T

      Returns any

  • serializer?: function
    • serializer(value: any): any

    • Parameters

      • value: any

      Returns any

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> ]: EntityDataItem<T[K]> }

Type parameters

  • T

SeederOptions

SeederOptions: { defaultSeeder?: string; emit?: js | ts; glob?: string; path?: string; pathTs?: string; fileName?: any }

Type declaration

  • optionaldefaultSeeder?: string
  • optionalemit?: js | ts
  • optionalglob?: string
  • optionalpath?: string
  • optionalpathTs?: string
  • fileName?: function
    • fileName(className: string): string

    • Parameters

      • className: string

      Returns 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; 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; smallint: typeof SmallIntType; string: typeof StringType; text: typeof TextType; time: typeof TimeType; tinyint: typeof TinyIntType; uuid: typeof UuidType } = ...

Type declaration