UNPKG

multibridge

Version:

A multi-database connection framework with centralized configuration

36 lines (35 loc) 1.05 kB
/** * TypeORM adapter for MultiBridge * Supports: PostgreSQL, MySQL, MongoDB, Cassandra */ import { DataSource, DataSourceOptions } from "typeorm"; /** * Get or create a TypeORM DataSource for the current tenant * * @param options - TypeORM DataSource options (entities, migrations, etc.) * @returns TypeORM DataSource instance configured for the current tenant * * @example * ```typescript * await runWithTenant(tenant, async () => { * const dataSource = await getTypeORMDataSource({ * entities: [User, Order], * }); * const userRepo = dataSource.getRepository(User); * await userRepo.find(); * }); * ``` */ export declare function getTypeORMDataSource(options?: Partial<DataSourceOptions>): Promise<DataSource>; /** * Close TypeORM DataSource for a specific tenant */ export declare function closeTypeORMDataSource(tenant?: { appid: string; orgid: string; appdbname: string; }): Promise<void>; /** * Close all TypeORM DataSources */ export declare function closeAllTypeORMDataSources(): Promise<void>;