91 lines
3.3 KiB
TypeScript
91 lines
3.3 KiB
TypeScript
import {
|
|
type RawQueryFragment,
|
|
type Constructor,
|
|
type EntityManager,
|
|
type EntityRepository,
|
|
type IDatabaseDriver,
|
|
type IsolationLevel,
|
|
type MikroORM,
|
|
Platform,
|
|
} from '@mikro-orm/core';
|
|
import { SqlSchemaGenerator } from './schema/SqlSchemaGenerator.js';
|
|
import { type SchemaHelper } from './schema/SchemaHelper.js';
|
|
import type { IndexDef } from './typings.js';
|
|
import { NativeQueryBuilder } from './query/NativeQueryBuilder.js';
|
|
/** Base class for SQL database platforms, providing SQL generation and quoting utilities. */
|
|
export declare abstract class AbstractSqlPlatform extends Platform {
|
|
#private;
|
|
protected readonly schemaHelper?: SchemaHelper;
|
|
usesPivotTable(): boolean;
|
|
indexForeignKeys(): boolean;
|
|
getRepositoryClass<T extends object>(): Constructor<EntityRepository<T>>;
|
|
getSchemaHelper(): SchemaHelper | undefined;
|
|
/** @inheritDoc */
|
|
lookupExtensions(orm: MikroORM): void;
|
|
getSchemaGenerator(driver: IDatabaseDriver, em?: EntityManager): SqlSchemaGenerator;
|
|
/** @internal */
|
|
createNativeQueryBuilder(): NativeQueryBuilder;
|
|
getBeginTransactionSQL(options?: { isolationLevel?: IsolationLevel; readOnly?: boolean }): string[];
|
|
getCommitTransactionSQL(): string;
|
|
getRollbackTransactionSQL(): string;
|
|
getSavepointSQL(savepointName: string): string;
|
|
getRollbackToSavepointSQL(savepointName: string): string;
|
|
getReleaseSavepointSQL(savepointName: string): string;
|
|
quoteValue(value: any): string;
|
|
getSearchJsonPropertySQL(path: string, type: string, aliased: boolean): string | RawQueryFragment;
|
|
getSearchJsonPropertyKey(path: string[], type: string, aliased: boolean, value?: unknown): string | RawQueryFragment;
|
|
/**
|
|
* Quotes a key for use inside a JSON path expression (e.g. `$.key`).
|
|
* Simple alphanumeric keys are left unquoted; others are wrapped in double quotes.
|
|
* @internal
|
|
*/
|
|
quoteJsonKey(key: string): string;
|
|
getJsonIndexDefinition(index: IndexDef): string[];
|
|
supportsUnionWhere(): boolean;
|
|
supportsSchemas(): boolean;
|
|
/** @inheritDoc */
|
|
generateCustomOrder(escapedColumn: string, values: unknown[]): string;
|
|
/**
|
|
* @internal
|
|
*/
|
|
getOrderByExpression(column: string, direction: string, collation?: string): string[];
|
|
/**
|
|
* Quotes a collation name for use in COLLATE clauses.
|
|
* @internal
|
|
*/
|
|
quoteCollation(collation: string): string;
|
|
/** @internal */
|
|
protected validateCollationName(collation: string): void;
|
|
/** @internal */
|
|
validateJsonPropertyName(name: string): void;
|
|
/**
|
|
* Returns FROM clause for JSON array iteration.
|
|
* @internal
|
|
*/
|
|
getJsonArrayFromSQL(
|
|
column: string,
|
|
alias: string,
|
|
_properties: {
|
|
name: string;
|
|
type: string;
|
|
}[],
|
|
): string;
|
|
/**
|
|
* Returns SQL expression to access an element's property within a JSON array iteration.
|
|
* @internal
|
|
*/
|
|
getJsonArrayElementPropertySQL(alias: string, property: string, _type: string): string;
|
|
/**
|
|
* Wraps JSON array FROM clause and WHERE condition into a full EXISTS condition.
|
|
* MySQL overrides this because `json_table` doesn't support correlated subqueries.
|
|
* @internal
|
|
*/
|
|
getJsonArrayExistsSQL(from: string, where: string): string;
|
|
/**
|
|
* Maps a runtime type name (e.g. 'string', 'number') to a driver-specific bind type constant.
|
|
* Used by NativeQueryBuilder for output bindings.
|
|
* @internal
|
|
*/
|
|
mapToBindType(type: string): unknown;
|
|
}
|