typeorm-sharding-repository
Version:
TypeORM Sharding Repository: Enables TypeORM to be utilized in a distributed database environment.
16 lines (15 loc) • 752 B
TypeScript
import { DataSource, DeepPartial } from 'typeorm';
import { ShardingBaseEntity } from './sharding-base-entity';
import { ShardingDataSourceOptions } from './types/typeorm-sharding.type';
export declare class ShardingManager {
readonly options: ShardingDataSourceOptions;
readonly dataSources: DataSource[];
private _destroyed;
get destroyed(): boolean;
protected constructor(options: ShardingDataSourceOptions);
protected init(): Promise<this>;
static init(options: ShardingDataSourceOptions): Promise<ShardingManager>;
getDataSource(entity: DeepPartial<ShardingBaseEntity>, shardingFunc: Function): DataSource;
getDataSourceById(id: unknown, shardingFuncById: Function): DataSource;
destroy(): Promise<void>;
}