import { type CountOptions, type DeleteOptions, type DriverMethodOptions, EntityManagerType, type FindOneOptions, type FindOptions, type IDatabaseDriver, type LockOptions, type NativeInsertUpdateManyOptions, type NativeInsertUpdateOptions, type OrderDefinition, type StreamOptions } from './IDatabaseDriver.js'; import type { ConnectionType, Constructor, Dictionary, EntityData, EntityDictionary, EntityMetadata, EntityName, EntityProperty, FilterQuery, PopulateOptions, Primary } from '../typings.js'; import type { MetadataStorage } from '../metadata/MetadataStorage.js'; import type { Connection, QueryResult, Transaction } from '../connections/Connection.js'; import { type Configuration, type ConnectionOptions } from '../utils/Configuration.js'; import type { EntityComparator } from '../utils/EntityComparator.js'; import { type QueryOrder } from '../enums.js'; import type { Platform } from '../platforms/Platform.js'; import type { Collection } from '../entity/Collection.js'; import { EntityManager } from '../EntityManager.js'; import { DriverException } from '../exceptions.js'; import { MikroORM } from '../MikroORM.js'; /** Abstract base class for all database drivers, implementing common driver logic. */ export declare abstract class DatabaseDriver implements IDatabaseDriver { readonly config: Configuration; protected readonly dependencies: string[]; [EntityManagerType]: EntityManager; protected readonly connection: C; protected readonly replicas: C[]; protected readonly platform: Platform; protected comparator: EntityComparator; protected metadata: MetadataStorage; protected constructor(config: Configuration, dependencies: string[]); abstract find(entityName: EntityName, where: FilterQuery, options?: FindOptions): Promise[]>; abstract findOne(entityName: EntityName, where: FilterQuery, options?: FindOneOptions): Promise | null>; abstract nativeInsert(entityName: EntityName, data: EntityDictionary, options?: NativeInsertUpdateOptions): Promise>; abstract nativeInsertMany(entityName: EntityName, data: EntityDictionary[], options?: NativeInsertUpdateManyOptions, transform?: (sql: string) => string): Promise>; abstract nativeUpdate(entityName: EntityName, where: FilterQuery, data: EntityDictionary, options?: NativeInsertUpdateOptions): Promise>; nativeUpdateMany(entityName: EntityName, where: FilterQuery[], data: EntityDictionary[], options?: NativeInsertUpdateManyOptions): Promise>; abstract nativeDelete(entityName: EntityName, where: FilterQuery, options?: DeleteOptions): Promise>; abstract count(entityName: EntityName, where: FilterQuery, options?: CountOptions): Promise; /** Creates a new EntityManager instance bound to this driver. */ createEntityManager(useContext?: boolean): this[typeof EntityManagerType]; findVirtual(entityName: EntityName, where: FilterQuery, options: FindOptions): Promise[]>; countVirtual(entityName: EntityName, where: FilterQuery, options: CountOptions): Promise; aggregate(entityName: EntityName, pipeline: any[]): Promise; loadFromPivotTable(prop: EntityProperty, owners: Primary[][], where?: FilterQuery, orderBy?: OrderDefinition, ctx?: Transaction, options?: FindOptions, pivotJoin?: boolean): Promise>; syncCollections(collections: Iterable>, options?: DriverMethodOptions): Promise; /** Maps raw database result to entity data, converting column names to property names. */ mapResult(result: EntityDictionary, meta?: EntityMetadata, populate?: PopulateOptions[]): EntityData | null; /** Opens the primary connection and all read replicas. */ connect(options?: { skipOnConnect?: boolean; }): Promise; /** Closes all connections and re-establishes them. */ reconnect(options?: { skipOnConnect?: boolean; }): Promise; /** Returns the write connection or a random read replica. */ getConnection(type?: ConnectionType): C; /** Closes the primary connection and all read replicas. */ close(force?: boolean): Promise; /** Returns the database platform abstraction for this driver. */ getPlatform(): Platform; /** Sets the metadata storage and initializes the comparator for all connections. */ setMetadata(metadata: MetadataStorage): void; /** Returns the metadata storage used by this driver. */ getMetadata(): MetadataStorage; /** Returns the names of native database dependencies required by this driver. */ getDependencies(): string[]; protected isPopulated(meta: EntityMetadata, prop: EntityProperty, hint: PopulateOptions, name?: string): boolean; protected processCursorOptions(meta: EntityMetadata, options: FindOptions, orderBy: OrderDefinition): { orderBy: OrderDefinition[]; where: FilterQuery; }; protected createCursorCondition(definition: (readonly [keyof T & string, QueryOrder])[], offsets: Dictionary[], inverse: boolean, meta: EntityMetadata): FilterQuery; /** @internal */ mapDataToFieldNames(data: Dictionary, stringifyJsonArrays: boolean, properties?: Record, convertCustomTypes?: boolean, object?: boolean): Dictionary; protected inlineEmbeddables(meta: EntityMetadata, data: T, where?: boolean): void; protected getPrimaryKeyFields(meta: EntityMetadata): string[]; protected createReplicas(cb: (c: ConnectionOptions) => C): C[]; /** Acquires a pessimistic lock on the given entity. */ lockPessimistic(entity: T, options: LockOptions): Promise; abstract stream(entityName: EntityName, where: FilterQuery, options: StreamOptions): AsyncIterableIterator; /** * @inheritDoc */ convertException(exception: Error): DriverException; protected rethrow(promise: Promise): Promise; /** * @internal */ getTableName(meta: EntityMetadata, options: NativeInsertUpdateManyOptions, quote?: boolean): string; /** * @internal */ getSchemaName(meta?: EntityMetadata, options?: { schema?: string; parentSchema?: string; }): string | undefined; /** @internal */ getORMClass(): Constructor; }