@mikro-orm/core
Index
Classes
- AbstractNamingStrategy
- AbstractSchemaGenerator
- ArrayCollection
- ArrayType
- BaseEntity
- BigIntType
- BlobType
- BooleanType
- ChangeSet
- ChangeSetComputer
- ChangeSetPersister
- CharacterType
- CheckConstraintViolationException
- Collection
- Configuration
- Connection
- ConnectionException
- ConstraintViolationException
- Cursor
- CursorError
- DatabaseDriver
- DatabaseObjectExistsException
- DatabaseObjectNotFoundException
- DataloaderUtils
- DateTimeType
- DateType
- DeadlockException
- DecimalType
- DefaultLogger
- DoubleType
- DriverException
- EntityAssigner
- EntityCaseNamingStrategy
- EntityComparator
- EntityFactory
- EntityLoader
- EntityManager
- EntityMetadata
- EntityRepository
- EntitySchema
- EntitySerializer
- EntityTransformer
- EntityValidator
- EnumArrayType
- EnumType
- EventManager
- ExceptionConverter
- FileCacheAdapter
- FloatType
- ForeignKeyConstraintViolationException
- GeneratedCacheAdapter
- Hydrator
- IdentityMap
- IntegerType
- IntervalType
- InvalidFieldNameException
- JsonType
- LockWaitTimeoutException
- MediumIntType
- MemoryCacheAdapter
- MetadataDiscovery
- MetadataError
- MetadataProvider
- MetadataStorage
- MikroORM
- MongoNamingStrategy
- NonUniqueFieldNameException
- NotFoundError
- NotNullConstraintViolationException
- NullCacheAdapter
- NullHighlighter
- ObjectHydrator
- OptimisticLockError
- PlainObject
- Platform
- QueryHelper
- RawQueryFragment
- ReadOnlyException
- Reference
- ReflectMetadataProvider
- RequestContext
- ScalarReference
- SerializationContext
- ServerException
- SimpleLogger
- SmallIntType
- StringType
- SyntaxErrorException
- TableExistsException
- TableNotFoundException
- TextType
- TimeType
- TinyIntType
- TransactionContext
- TransactionEventBroadcaster
- Type
- Uint8ArrayType
- UnderscoreNamingStrategy
- UniqueConstraintViolationException
- UnitOfWork
- UnknownType
- Utils
- UuidType
- ValidationError
- WrappedEntity
Enumerations
Functions
- AfterCreate
- AfterDelete
- AfterUpdate
- AfterUpsert
- BeforeCreate
- BeforeDelete
- BeforeUpdate
- BeforeUpsert
- Check
- CreateRequestContext
- Embeddable
- Embedded
- EnsureRequestContext
- Entity
- Enum
- Filter
- Formula
- Index
- ManyToMany
- ManyToOne
- OnInit
- OnLoad
- OneToMany
- OneToOne
- PrimaryKey
- Property
- SerializedPrimaryKey
- Unique
- assign
- compareArrays
- compareBooleans
- compareBuffers
- compareObjects
- createSqlFunction
- defineConfig
- equals
- parseJsonSafe
- raw
- ref
- rel
- serialize
- sql
- wrap
Interfaces
- AssignOptions
- CacheAdapter
- ClearDatabaseOptions
- ConnectionConfig
- ConnectionOptions
- CountOptions
- CreateContextOptions
- CreateOptions
- CreateSchemaOptions
- DeleteOptions
- DriverMethodOptions
- DropSchemaOptions
- DynamicPassword
- Edge
- EnsureDatabaseOptions
- EntityProperty
- EnumOptions
- EventArgs
- EventSubscriber
- FactoryOptions
- FindAllOptions
- FindByCursorOptions
- FindOneOptions
- FindOneOrFailOptions
- FindOptions
- FlatQueryOrderMap
- FlushEventArgs
- ForkOptions
- FormulaOptions
- GenerateOptions
- GetReferenceOptions
- Highlighter
- IConfiguration
- IDatabaseDriver
- IEntityGenerator
- IMigrationGenerator
- IMigrator
- ISchemaGenerator
- ISeedManager
- IWrappedEntity
- IndexOptions
- InitCollectionOptions
- LoadCountOptions
- LoadReferenceOptions
- LoadReferenceOrFailOptions
- LoadedCollection
- LoadedReference
- LockOptions
- LogContext
- Logger
- LoggerOptions
- ManyToManyOptions
- ManyToOneOptions
- MatchingOptions
- MergeOptions
- MetadataDiscoveryOptions
- MigrationDiff
- MigrationObject
- MikroORMOptions
- NamingStrategy
- NativeDeleteOptions
- NativeInsertUpdateManyOptions
- NativeInsertUpdateOptions
- Node
- OneToOneOptions
- PoolConfig
- PrimaryKeyOptions
- QueryResult
- ReferenceOptions
- RefreshDatabaseOptions
- RegisterOptions
- SeederOptions
- SerializeOptions
- SerializedPrimaryKeyOptions
- Settings
- SimpleColumnMeta
- SyncCacheAdapter
- TransactionEventArgs
- TransactionOptions
- TransformContext
- TypeConfig
- UniqueOptions
- UpdateOptions
- UpdateSchemaOptions
- UpsertManyOptions
- UpsertOptions
Type Aliases
- AnyEntity
- AutoPath
- Cast
- CheckCallback
- CheckOptions
- ConnectionType
- Constructor
- DeepPartial
- DefineConfig
- Dictionary
- EmbeddableOptions
- EmbeddedOptions
- EntityClass
- EntityClassGroup
- EntityDTO
- EntityData
- EntityDictionary
- EntityField
- EntityKey
- EntityLoaderOptions
- EntityName
- EntityOptions
- EntityProps
- EntityRef
- EntitySchemaMetadata
- EntitySchemaProperty
- EntityType
- EntityValue
- ExpandHint
- ExpandProperty
- ExpandQuery
- ExpandScalar
- FilterItemValue
- FilterKey
- FilterObject
- FilterOptions
- FilterQuery
- FilterValue
- FromEntityType
- GetRepository
- Hidden
- IPrimaryKey
- IType
- ImportsResolver
- IsSubset
- IsUnknown
- Loaded
- LoggerNamespace
- LoggingOptions
- MergeLoaded
- MergeSelected
- MetadataProcessor
- MigrateOptions
- MigrationResult
- MigrationRow
- MigrationsOptions
- New
- NoInfer
- ObjectQuery
- OneToManyOptions
- Opt
- Options
- OrderDefinition
- Populate
- PopulateOptions
- Primary
- PrimaryProperty
- PropertyOptions
- QBFilterQuery
- QBQueryOrderMap
- QueryOrderKeys
- QueryOrderKeysFlat
- QueryOrderMap
- Ref
- Rel
- RequiredEntityData
- Scalar
- ScalarRef
- Selected
- Transaction
- TransactionEventType
- UmzugMigration
- UnboxArray
Variables
Type Aliases
AnyEntity
Type parameters
- T = any
AutoPath
Type parameters
- O
- P: string | boolean
- E: string = never
- D: Prev[number] = 9
Cast
Type parameters
- T
- R
CheckCallback
Type parameters
- T
Type declaration
Parameters
columns: Record<keyof T, string>
Returns string
CheckOptions
Type parameters
- T = any
ConnectionType
Constructor
Type parameters
- T = unknown
Type declaration
Parameters
rest...args: any[]
Returns T
DeepPartial
Type parameters
- T
DefineConfig
Type parameters
- T: TypeConfig
Dictionary
Type parameters
- T = any
Type declaration
[k string]: T
EmbeddableOptions
Type declaration
optionalabstract?: boolean
optionaldiscriminatorColumn?: string
optionaldiscriminatorMap?: Dictionary<string>
optionaldiscriminatorValue?: number | string
EmbeddedOptions
Type declaration
optionalarray?: boolean
optionalentity?: string | () => AnyEntity | AnyEntity[]
optionalgroups?: string[]
optionalhidden?: boolean
optionalnullable?: boolean
optionalobject?: boolean
optionalpersist?: boolean
optionalprefix?: string | boolean
optionalserializedName?: string
optionalserializer?: (value: any) => any
Parameters
value: any
Returns any
optionaltype?: string
EntityClass
Type parameters
- T
EntityClassGroup
Type parameters
- T
Type declaration
entity: EntityClass<T>
schema: EntityMetadata<T> | EntitySchema<T>
EntityDTO
Type parameters
- T
- C: TypeConfig = never
EntityData
Type parameters
- T
- C: boolean = false
EntityDictionary
Type parameters
- T
EntityField
Type parameters
- T
- P: string = PopulatePath.ALL
EntityKey
Type parameters
- T = unknown
- B: boolean = false
EntityLoaderOptions
Type parameters
- Entity
- Fields: string = PopulatePath.ALL
- Excludes: string = never
Type declaration
optionalconnectionType?: ConnectionType
optionalconvertCustomTypes?: boolean
optionalexclude?: readonly EntityField<Entity, Excludes>[]
optionalfields?: readonly EntityField<Entity, Fields>[]
optionalfilters?: Dictionary<boolean | Dictionary> | string[] | boolean
optionalignoreLazyScalarProperties?: boolean
optionallockMode?: Exclude<LockMode, LockMode.OPTIMISTIC>
optionallogging?: LoggingOptions
optionallookup?: boolean
optionalorderBy?: QueryOrderMap<Entity> | QueryOrderMap<Entity>[]
optionalpopulateWhere?: PopulateHint | `${PopulateHint}`
optionalrefresh?: boolean
optionalschema?: string
optionalstrategy?: LoadStrategy
optionalvalidate?: boolean
optionalwhere?: FilterQuery<Entity>
EntityName
Type parameters
- T
EntityOptions
Type parameters
- T
Type declaration
optionalabstract?: boolean
optionalcollection?: string
optionalcomment?: string
optionaldiscriminatorColumn?: string
optionaldiscriminatorMap?: Dictionary<string>
optionaldiscriminatorValue?: number | string
optionalexpression?: string | (em: any, where: FilterQuery<T>, options: FindOptions<T, any, any, any>) => object
optionalforceConstructor?: boolean
optionalreadonly?: boolean
optionalrepository?: () => Constructor
Returns Constructor
optionalschema?: string
optionaltableName?: string
optionalvirtual?: boolean
EntityProps
Type parameters
- T
EntityRef
Type parameters
- T: object
EntitySchemaMetadata
Type parameters
- Entity
- Base = never
EntitySchemaProperty
Type parameters
- Target
- Owner
EntityType
Type parameters
- T
EntityValue
Type parameters
- T
ExpandHint
Type parameters
- T
- L: string
ExpandProperty
Type parameters
- T
ExpandQuery
Type parameters
- T
ExpandScalar
Type parameters
- T
FilterItemValue
Type parameters
- T
FilterKey
Type parameters
- T
FilterObject
Type parameters
- T
FilterOptions
FilterQuery
Type parameters
- T
FilterValue
Type parameters
- T
FromEntityType
Type parameters
- T
GetRepository
Type parameters
- Entity: {}
- Fallback
Hidden
Type parameters
- T = unknown
IPrimaryKey
Type parameters
- T: IPrimaryKeyValue = IPrimaryKeyValue
IType
Type parameters
- Runtime
- Raw
- Serialized = Raw
ImportsResolver
Type declaration
Parameters
alias: string
basePath: string
extension: .js |
originFileName: string
Returns { name: string; path: string } | undefined
IsSubset
Type parameters
- T
- U
IsUnknown
Type parameters
- T
Loaded
Represents entity with its loaded relations (populate
hint) and selected properties (fields
hint).
Type parameters
- T
- L: string = never
- F: string = *
- E: string = never
LoggerNamespace
LoggingOptions
Logger options to modify format output and overrides, including a label and additional properties that can be accessed by custom loggers.
Differs from LoggerOptions in terms of how they are used; this type is primarily a public type meant to be used within methods like em.find()
.
MergeLoaded
Type parameters
- T
- U
- P: string
- F: string
- E: string
- R: boolean = false
MergeSelected
Type parameters
- T
- U
- F: string
MetadataProcessor
Type declaration
Parameters
metadata: EntityMetadata[]
platform: Platform
Returns MaybePromise<void>
MigrateOptions
Type declaration
optionalfrom?: string | number
optionalmigrations?: string[]
optionalto?: string | number
optionaltransaction?: Transaction
MigrationResult
Type declaration
code: string
diff: MigrationDiff
fileName: string
MigrationRow
Type declaration
executed_at: Date
name: string
MigrationsOptions
Type declaration
optionalallOrNothing?: boolean
optionaldisableForeignKeys?: boolean
optionaldropTables?: boolean
optionalemit?: js | ts | cjs
optionalfileName?: (timestamp: string, name?: string) => string
Parameters
timestamp: string
optionalname: string
Returns string
optionalgenerator?: Constructor<IMigrationGenerator>
optionalglob?: string
optionalmigrationsList?: MigrationObject[]
optionalpath?: string
optionalpathTs?: string
optionalsafe?: boolean
optionalsilent?: boolean
optionalsnapshot?: boolean
optionalsnapshotName?: string
optionaltableName?: string
optionaltransactional?: boolean
New
Type parameters
- T
- P: string = string
NoInfer
Type parameters
- T
ObjectQuery
Type parameters
- T
OneToManyOptions
Type parameters
- Owner
- Target
Opt
Type parameters
- T = unknown
Options
Type parameters
- D: IDatabaseDriver = IDatabaseDriver
- EM: D[typeof EntityManagerType] & EntityManager = D[typeof EntityManagerType] & EntityManager
OrderDefinition
Type parameters
- T
Populate
Type parameters
- T
- P: string = never
PopulateOptions
Type parameters
- T
Type declaration
optionalall?: boolean
optionalchildren?: PopulateOptions<T[keyof T]>[]
field: EntityKey<T>
optionalfilter?: boolean
optionalstrategy?: LoadStrategy
Primary
Type parameters
- T
PrimaryProperty
Type parameters
- T
PropertyOptions
Type parameters
- Owner
Type declaration
optionalautoincrement?: boolean
Explicitly specify the auto increment of the primary key.
optionalcheck?: string | CheckCallback<Owner>
Specify column with check constraints. (Postgres driver only)
optionalcolumnType?: ColumnType | AnyString
Specify exact database column type for Generator. (SQL only)
optionalcomment?: string
Specify comment of column for Generator. (SQL only)
optionalconcurrencyCheck?: boolean
Set to true to enable Locking via concurrency fields.
optionalcustomOrder?: string[] | number[] | boolean[]
Specify a custom order based on the values. (SQL only)
optionaldefault?: string | string[] | number | number[] | boolean | null
Specify default column value for Generator. This is a runtime value, assignable to the entity property. (SQL only)
optionaldefaultRaw?: string
Specify SQL functions for Generator. (SQL only) Since v4 you should use defaultRaw for SQL functions. e.g. now()
optionalextra?: string
mysql only
optionalfieldName?: string
Specify database column name for this property.
optionalfieldNames?: string[]
Specify database column names for this property. Same as
fieldName
but for composite FKs.optionalformula?: string | (alias: string) => string
Set to map some SQL snippet for the entity.
optionalgenerated?: string | GeneratedColumnCallback<Owner>
For generated columns. This will be appended to the column type after the
generated always
clause.optionalgetter?: boolean
Set true to define the properties as getter. (virtual)
optionalgroups?: string[]
Specify serialization groups for
serialize()
calls. If a property does not specify any group, it will be included, otherwise only properties with a matching group are included.optionalhidden?: boolean
Set to true to omit the property when Serializing.
optionalhydrate?: boolean
Set false to disable hydration of this property. Useful for persisted getters.
optionalignoreSchemaChanges?: (type | extra | default)[]
Set to avoid a perpetual diff from the Generator when columns are generated.
optionalindex?: boolean | string
Explicitly specify index on a property.
optionallazy?: boolean
Set to omit the property from the select clause for lazy loading.
optionallength?: number
Set length of database column, used for datetime/timestamp/varchar column types for Generator. (SQL only)
optionalname?: string
Alias for
fieldName
.optionalnullable?: boolean
Set column as nullable for Generator.
optionalonCreate?: (entity: Owner, em: EntityManager) => any
Automatically set the property value when entity gets created, executed during flush operation.
Parameters
entity: Owner
em: EntityManager
Returns any
optionalonUpdate?: (entity: Owner, em: EntityManager) => any
Automatically update the property value every time entity gets updated, executed during flush operation.
Parameters
entity: Owner
em: EntityManager
Returns any
optionalpersist?: boolean
Set false to define Property.
optionalprecision?: number
Set precision of database column to represent the number of significant digits. (SQL only)
optionalprimary?: boolean
Set true to define entity's unique primary key identifier. Alias for
@PrimaryKey()
decoratoroptionalref?: boolean
Enable
ScalarReference
wrapper for lazy values. Use this in combination withlazy: true
to have a type-safe accessor object in place of the value.optionalreturning?: boolean
Add the property to the
returning
statement.optionalruntimeType?: string
Runtime type of the property. This is the JS type that your property is mapped to, e.g.
string
ornumber
, and is normally inferred automatically viareflect-metadata
. In some cases, the inference won't work, and you might need to specify theruntimeType
explicitly - the most common one is when you use a union type with null likefoo: number | null
.optionalscale?: number
Set scale of database column to represents the number of digits after the decimal point. (SQL only)
optionalserializedName?: string
Specify name of key for the serialized value.
optionalserializedPrimaryKey?: boolean
Set to define serialized primary key for MongoDB. (virtual) Alias for
@SerializedPrimaryKey()
decorator.optionalserializer?: (value: any) => any
Set to use serialize property. Allow to specify a callback that will be used when serializing a property.
Parameters
value: any
Returns any
optionalsetter?: boolean
Set true to define the properties as setter. (virtual)
optionaltrackChanges?: boolean
Set false to disable change tracking on a property level.
optionaltype?: keyof typeof types | ObjectId | Date | Constructor<AnyEntity> | Constructor<Type<any>> | Type<any> | () => unknown | ColumnType | AnyString
Explicitly specify the runtime type.
optionalunique?: boolean | string
Set column as unique for Generator. (SQL only)
optionalunsigned?: boolean
Set column as unsigned for Generator. (SQL only)
optionalversion?: boolean
Set to true to enable Locking via version field. (SQL only)
QBFilterQuery
Type parameters
- T = any
QBQueryOrderMap
Type parameters
- T
QueryOrderKeys
Type parameters
- T
QueryOrderKeysFlat
QueryOrderMap
Type parameters
- T
Ref
Ref type represents a Reference
instance, and adds the primary keys to its prototype automatically, so you can do
ref.id
instead of ref.unwrap().id
. It resolves to either ScalarRef
or EntityRef
, based on the type argument.
Type parameters
- T
Rel
Identity type that can be used to get around issues with cycles in bidirectional relations. It will disable reflect-metadata inference.
Type parameters
- T
RequiredEntityData
Type parameters
- T
- I = never
- C: boolean = false
Scalar
ScalarRef
Selected
Type parameters
- T
- L: string = never
- F: string = *
Transaction
Type parameters
- T = any
TransactionEventType
UmzugMigration
Type declaration
name: string
optionalpath?: string
UnboxArray
Type parameters
- T
Variables
constARRAY_OPERATORS
constConfig
constEagerProps
constEntityManagerType
constEntityRepositoryType
constEventTypeMap
constHiddenProps
constJSON_KEY_OPERATORS
constJsonProperty
constObjectBindingPattern
constOptionalProps
constPrimaryKeyProp
constSCALAR_TYPES
constt
Type declaration
readonlyarray: typeof ArrayType
readonlybigint: typeof BigIntType
readonlyblob: typeof BlobType
readonlyboolean: typeof BooleanType
readonlycharacter: typeof CharacterType
readonlydate: typeof DateType
readonlydatetime: typeof DateTimeType
readonlydecimal: typeof DecimalType
readonlydouble: typeof DoubleType
readonlyenum: typeof EnumType
readonlyenumArray: typeof EnumArrayType
readonlyfloat: typeof FloatType
readonlyinteger: typeof IntegerType
readonlyinterval: typeof IntervalType
readonlyjson: typeof JsonType
readonlymediumint: typeof MediumIntType
readonlysmallint: typeof SmallIntType
readonlystring: typeof StringType
readonlytext: typeof TextType
readonlytime: typeof TimeType
readonlytinyint: typeof TinyIntType
readonlyuint8array: typeof Uint8ArrayType
readonlyunknown: typeof UnknownType
readonlyuuid: typeof UuidType
consttypes
Type declaration
readonlyarray: typeof ArrayType
readonlybigint: typeof BigIntType
readonlyblob: typeof BlobType
readonlyboolean: typeof BooleanType
readonlycharacter: typeof CharacterType
readonlydate: typeof DateType
readonlydatetime: typeof DateTimeType
readonlydecimal: typeof DecimalType
readonlydouble: typeof DoubleType
readonlyenum: typeof EnumType
readonlyenumArray: typeof EnumArrayType
readonlyfloat: typeof FloatType
readonlyinteger: typeof IntegerType
readonlyinterval: typeof IntervalType
readonlyjson: typeof JsonType
readonlymediumint: typeof MediumIntType
readonlysmallint: typeof SmallIntType
readonlystring: typeof StringType
readonlytext: typeof TextType
readonlytime: typeof TimeType
readonlytinyint: typeof TinyIntType
readonlyuint8array: typeof Uint8ArrayType
readonlyunknown: typeof UnknownType
readonlyuuid: typeof UuidType
Alias for
Reference<T> & { id: number }
(see Ref).