abstractPlatform
Hierarchy
- Platform
Index
Constructors
Methods
- allowsComparingTuples
- cloneEmbeddable
- compareUuids
- convertDateToJSValue
- convertIntervalToDatabaseValue
- convertIntervalToJSValue
- convertJsonToDatabaseValue
- convertJsonToJSValue
- convertsJsonAutomatically
- convertUuidToDatabaseValue
- convertUuidToJSValue
- convertVersionValue
- denormalizePrimaryKey
- escape
- extractSimpleType
- formatQuery
- generateCustomOrder
- getArrayDeclarationSQL
- getBigIntTypeDeclarationSQL
- getBlobDeclarationSQL
- getBooleanTypeDeclarationSQL
- getCharTypeDeclarationSQL
- getConfig
- getCurrentTimestampSQL
- getDateTimeTypeDeclarationSQL
- getDateTypeDeclarationSQL
- getDecimalTypeDeclarationSQL
- getDefaultCharLength
- getDefaultCharset
- getDefaultClientUrl
- getDefaultDateTimeLength
- getDefaultMappedType
- getDefaultPrimaryName
- getDefaultSchemaName
- getDefaultVarcharLength
- getDefaultVersionLength
- getDoubleDeclarationSQL
- getEnumTypeDeclarationSQL
- getExceptionConverter
- getExtension
- getFloatDeclarationSQL
- getFullTextIndexExpression
- getFullTextWhereClause
- getIndexName
- getIntegerTypeDeclarationSQL
- getIntervalTypeDeclarationSQL
- getJsonDeclarationSQL
- getJsonIndexDefinition
- getMappedType
- getMediumIntTypeDeclarationSQL
- getNamingStrategy
- getRegExpOperator
- getRegExpValue
- getRepositoryClass
- getSchemaGenerator
- getSchemaHelper
- getSearchJsonPropertyKey
- getSearchJsonPropertySQL
- getSmallIntTypeDeclarationSQL
- getTextTypeDeclarationSQL
- getTimeTypeDeclarationSQL
- getTimezone
- getTinyIntTypeDeclarationSQL
- getUuidTypeDeclarationSQL
- getVarcharTypeDeclarationSQL
- indexForeignKeys
- isAllowedTopLevelOperator
- isBigIntProperty
- isNumericColumn
- isNumericProperty
- isPopulated
- lookupExtensions
- mapRegExpCondition
- marshallArray
- normalizeColumnType
- normalizePrimaryKey
- parseDate
- processDateProperty
- processJsonCondition
- quoteIdentifier
- quoteValue
- setConfig
- shouldHaveColumn
- supportsCreatingFullTextIndex
- supportsCustomPrimaryKeyNames
- supportsDeferredUniqueConstraints
- supportsDownMigrations
- supportsMaterializedViews
- supportsMultipleCascadePaths
- supportsMultipleStatements
- supportsNativeEnums
- supportsOnUpdate
- supportsTransactions
- supportsUnionWhere
- supportsUnsigned
- unmarshallArray
- usesAsKeyword
- usesBatchInserts
- usesBatchUpdates
- usesCascadeStatement
- usesDefaultKeyword
- usesEnumCheckConstraints
- usesImplicitTransactions
- usesOutputStatement
- usesPivotTable
- usesReturningStatement
- validateMetadata
Constructors
constructor
Returns Platform
Methods
allowsComparingTuples
Whether the platform supports tuple comparison in WHERE clauses.
Returns boolean
cloneEmbeddable
Deep-clones embeddable data and tags it for JSON serialization.
Parameters
data: T
Returns T
compareUuids
Determines how UUID values are compared in the change set tracking. Return
'string'for inline string comparison (fast), or'any'for deep comparison via type methods.Returns string
convertDateToJSValue
Parameters
value: string | Date
Returns string
convertIntervalToDatabaseValue
Parameters
value: unknown
Returns unknown
convertIntervalToJSValue
Parameters
value: string
Returns unknown
convertJsonToDatabaseValue
Converts a JS value to its JSON database representation (typically JSON.stringify).
Parameters
value: unknown
optionalcontext: TransformContext
Returns unknown
convertJsonToJSValue
Converts a database JSON value to its JS representation.
Parameters
value: unknown
optionalcontext: TransformContext
Returns unknown
convertsJsonAutomatically
Whether the driver automatically parses JSON columns into JS objects.
Returns boolean
convertUuidToDatabaseValue
Parameters
value: unknown
Returns unknown
convertUuidToJSValue
Parameters
value: unknown
Returns unknown
convertVersionValue
Converts a version field value for comparison in optimistic locking queries.
Parameters
value: number | Date
prop: EntityProperty<any, any>
Returns string | number | Date | { $in: (string | number)[] }
denormalizePrimaryKey
Converts scalar primary key representation to native driver wrapper (e.g. string to mongodb's ObjectId)
Parameters
data: IPrimaryKeyValue
Returns IPrimaryKeyValue
escape
Parameters
value: any
Returns string
extractSimpleType
Extracts the base type name from a full SQL type declaration (e.g. "varchar(255)" -> "varchar").
Parameters
type: string
Returns string
formatQuery
Replaces
?placeholders in SQL with quoted parameter values.Parameters
sql: string
params: readonly any[]
Returns string
generateCustomOrder
Generates a custom order by statement given a set of in order values, eg. ORDER BY (CASE WHEN priority = 'low' THEN 1 WHEN priority = 'medium' THEN 2 ELSE NULL END)
Parameters
escapedColumn: string
values: unknown[]
Returns void
getArrayDeclarationSQL
Returns the SQL type declaration used for array storage.
Returns string
getBigIntTypeDeclarationSQL
Parameters
column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
optionalautoincrement: boolean
optionallength: number
optionalunsigned: boolean
Returns string
getBlobDeclarationSQL
Returns string
getBooleanTypeDeclarationSQL
Returns the SQL type declaration for boolean columns.
Returns string
getCharTypeDeclarationSQL
Parameters
column: { length?: number }
optionallength: number
Returns string
getConfig
Returns the current ORM configuration.
Returns Configuration<IDatabaseDriver<Connection>, EntityManager<IDatabaseDriver<Connection>>>
getCurrentTimestampSQL
Returns the SQL specific for the platform to get the current timestamp
Parameters
optionallength: number
Returns string
getDateTimeTypeDeclarationSQL
Returns the SQL type declaration for datetime columns.
Parameters
column: { length?: number }
optionallength: number
Returns string
getDateTypeDeclarationSQL
Returns the SQL type declaration for date columns.
Parameters
optionallength: number
Returns string
getDecimalTypeDeclarationSQL
Parameters
column: { precision?: number; scale?: number }
optionalprecision: number
optionalscale: number
Returns string
getDefaultCharLength
Returns the default length for char columns.
Returns number
getDefaultCharset
Returns the default character set for this platform.
Returns string
getDefaultClientUrl
Returns default client url for given driver (e.g. mongodb://127.0.0.1:27017 for mongodb)
Returns string
getDefaultDateTimeLength
Returns the default fractional seconds precision for datetime columns.
Returns number
getDefaultMappedType
Returns the default mapped Type for a given type string when no custom mapping is configured.
Parameters
type: string
Returns Type<unknown, unknown>
getDefaultPrimaryName
Returns the default primary key constraint name.
Parameters
tableName: string
columns: string[]
Returns string
getDefaultSchemaName
Returns the default schema name for this platform (e.g. "public" for PostgreSQL).
Returns undefined | string
getDefaultVarcharLength
Returns the default length for varchar columns.
Returns number
getDefaultVersionLength
Returns the default fractional seconds precision for version timestamp columns.
Returns number
getDoubleDeclarationSQL
Returns string
getEnumTypeDeclarationSQL
Parameters
column: { autoincrement?: boolean; fieldNames: string[]; items?: unknown[]; length?: number; unsigned?: boolean }
optionalautoincrement: boolean
fieldNames: string[]
optionalitems: unknown[]
optionallength: number
optionalunsigned: boolean
Returns string
getExceptionConverter
Returns the exception converter for translating native errors to driver exceptions.
Returns ExceptionConverter
getExtension
Retrieves a registered extension (e.g. SchemaGenerator, Migrator), throwing if not found.
Parameters
extensionName: string
extensionKey: string
moduleName: string
em: EntityManager<IDatabaseDriver<Connection>>
Returns T
getFloatDeclarationSQL
Returns string
getFullTextIndexExpression
Parameters
indexName: string
schemaName: undefined | string
tableName: string
columns: SimpleColumnMeta[]
Returns string
getFullTextWhereClause
Parameters
prop: EntityProperty<any, any>
Returns string
getIndexName
Returns the default name of index for the given columns
Parameters
tableName: string
columns: string[]
type: primary | index | unique | foreign | sequence
Returns string
getIntegerTypeDeclarationSQL
Returns the SQL type declaration for integer columns.
Parameters
column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
optionalautoincrement: boolean
optionallength: number
optionalunsigned: boolean
Returns string
getIntervalTypeDeclarationSQL
Parameters
column: { length?: number }
optionallength: number
Returns string
getJsonDeclarationSQL
Returns string
getJsonIndexDefinition
Parameters
index: { columnNames: string[] }
columnNames: string[]
Returns string[]
getMappedType
Returns the mapped Type instance for a given SQL/runtime type string.
Parameters
type: string
Returns Type<unknown, unknown>
getMediumIntTypeDeclarationSQL
Parameters
column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
optionalautoincrement: boolean
optionallength: number
optionalunsigned: boolean
Returns string
getNamingStrategy
Returns the default naming strategy constructor for this platform.
Returns new () => NamingStrategy
Returns NamingStrategy
getRegExpOperator
Returns the SQL operator used for regular expression matching.
Parameters
optionalval: unknown
optionalflags: string
Returns string
getRegExpValue
Converts a JavaScript RegExp into a platform-specific regex representation.
Parameters
val: RegExp
Returns { $flags?: string; $re: string }
optional$flags?: string
$re: string
getRepositoryClass
Returns the default EntityRepository class used by this platform.
Returns Constructor<EntityRepository<T>>
getSchemaGenerator
Parameters
driver: IDatabaseDriver<Connection>
optionalem: EntityManager<IDatabaseDriver<Connection>>
Returns ISchemaGenerator
getSchemaHelper
Returns the schema helper instance for this platform, or undefined if not supported.
Returns unknown
getSearchJsonPropertyKey
Parameters
path: string[]
type: string
aliased: boolean
optionalvalue: unknown
Returns string | RawQueryFragment<string>
getSearchJsonPropertySQL
Parameters
path: string
type: string
aliased: boolean
Returns string | RawQueryFragment<string>
getSmallIntTypeDeclarationSQL
Parameters
column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
optionalautoincrement: boolean
optionallength: number
optionalunsigned: boolean
Returns string
getTextTypeDeclarationSQL
Parameters
_column: { length?: number }
optionallength: number
Returns string
getTimeTypeDeclarationSQL
Returns the SQL type declaration for time columns.
Parameters
optionallength: number
Returns string
getTimezone
Returns the configured timezone, or undefined if not set.
Returns undefined | string
getTinyIntTypeDeclarationSQL
Parameters
column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
optionalautoincrement: boolean
optionallength: number
optionalunsigned: boolean
Returns string
getUuidTypeDeclarationSQL
Parameters
column: { length?: number }
optionallength: number
Returns string
getVarcharTypeDeclarationSQL
Parameters
column: { length?: number }
optionallength: number
Returns string
indexForeignKeys
Whether the platform automatically creates indexes on foreign key columns.
Returns boolean
isAllowedTopLevelOperator
Whether the given operator is allowed at the top level of a query condition.
Parameters
operator: string
Returns boolean
isBigIntProperty
Whether the given property maps to a bigint database column.
Parameters
prop: EntityProperty<any, any>
Returns boolean
isNumericColumn
Whether the given mapped type represents a numeric column.
Parameters
mappedType: Type<unknown, unknown>
Returns boolean
isNumericProperty
Whether the given property represents a numeric database column.
Parameters
prop: EntityProperty<any, any>
ignoreCustomType: boolean = false
Returns boolean
isPopulated
Whether the given property key is included in the populate hint.
Parameters
key: string
populate: boolean | readonly PopulateOptions<T>[]
Returns boolean
lookupExtensions
Allows registering extensions of the driver automatically (e.g.
SchemaGeneratorextension in SQL drivers).Parameters
orm: MikroORM<IDatabaseDriver<Connection>, EntityManager<IDatabaseDriver<Connection>>, (string | EntitySchema<any, never, EntityCtor<any>> | EntityClass<Partial<any>>)[]>
Returns void
mapRegExpCondition
Builds the SQL clause and parameters for a regular expression condition.
Parameters
mappedKey: string
value: { $flags?: string; $re: string }
optional$flags: string
$re: string
Returns { params: unknown[]; sql: string }
params: unknown[]
sql: string
marshallArray
Serializes a string array into its database storage format.
Parameters
values: string[]
Returns string
normalizeColumnType
This should be used only to compare types, it can strip some information like the length.
Parameters
type: string
options: { length?: number; precision?: number; scale?: number }
optionallength: number
optionalprecision: number
optionalscale: number
Returns string
normalizePrimaryKey
Normalizes primary key wrapper to scalar value (e.g. mongodb's ObjectId to string)
Parameters
data: IPrimaryKeyValue | Primary<T>
Returns T
parseDate
Parses a string or numeric value into a Date object.
Parameters
value: string | number
Returns Date
processDateProperty
Processes a date value before persisting, applying timezone or format conversions.
Parameters
value: unknown
Returns string | number | Date
processJsonCondition
Parameters
o: FilterQuery<T>
value: EntityValue<T>
path: EntityKey<T>[]
alias: boolean
Returns FilterQuery<T>
quoteIdentifier
Wraps a table or column identifier with the platform-specific quote character.
Parameters
id: string | { toString: () => string }
toString: () => string
quote: string = '`'
Returns string
quoteValue
Quotes a literal value for safe embedding in SQL.
Parameters
value: any
Returns string
setConfig
Initializes the platform with the ORM configuration.
Parameters
Returns void
shouldHaveColumn
Whether the given property should be included as a column in the SELECT query.
Parameters
prop: EntityProperty<T, any>
populate: boolean | readonly PopulateOptions<T>[]
optionalexclude: string[]
includeFormulas: boolean = true
ignoreInlineEmbeddables: boolean = true
Returns boolean
supportsCreatingFullTextIndex
Returns boolean
supportsCustomPrimaryKeyNames
Whether the platform supports custom names for primary key constraints.
Returns boolean
supportsDeferredUniqueConstraints
Whether the platform supports deferred unique constraints.
Returns boolean
supportsDownMigrations
Whether the platform supports generating down migrations.
Returns boolean
supportsMaterializedViews
Whether this platform supports materialized views.
Returns boolean
supportsMultipleCascadePaths
Whether the platform supports multiple cascade paths to the same table.
Returns boolean
supportsMultipleStatements
Whether the connection supports executing multiple SQL statements in a single call.
Returns boolean
supportsNativeEnums
for postgres native enums
Returns boolean
supportsOnUpdate
Returns true if the platform supports ON UPDATE foreign key rules. Oracle doesn't support ON UPDATE rules.
Returns boolean
supportsTransactions
Whether this driver supports database transactions.
Returns boolean
supportsUnionWhere
Whether the platform supports the UNION WHERE optimization for multi-branch queries.
Returns boolean
supportsUnsigned
Whether the platform supports unsigned integer columns.
Returns boolean
unmarshallArray
Deserializes a database-stored array string back into a string array.
Parameters
value: string
Returns string[]
usesAsKeyword
Returns boolean
usesBatchInserts
Whether or not the driver supports retuning list of created PKs back when multi-inserting
Returns boolean
usesBatchUpdates
Whether or not the driver supports updating many records at once
Returns boolean
usesCascadeStatement
Whether DELETE statements require explicit CASCADE keyword.
Returns boolean
usesDefaultKeyword
Whether the platform supports the DEFAULT keyword in INSERT statements.
Returns boolean
usesEnumCheckConstraints
for postgres text enums (default)
Returns boolean
usesImplicitTransactions
Whether the driver wraps operations in implicit transactions by default.
Returns boolean
usesOutputStatement
Whether the driver supports OUTPUT clause (e.g. MSSQL).
Returns boolean
usesPivotTable
Whether this driver uses pivot tables for M:N relations (SQL drivers do, MongoDB does not).
Returns boolean
usesReturningStatement
Whether the driver supports RETURNING clause (e.g. PostgreSQL).
Returns boolean
validateMetadata
Platform-specific validation of entity metadata.
Parameters
meta: EntityMetadata<any, EntityCtor<any>>
Returns void
Abstract base class providing database-specific behavior and SQL dialect differences.