UNPKG

nest-typeorm-sharding-repository

Version:

This module extends TypeORM capabilities to support distributed database environments with List and Range-based sharding strategies in a NestJS application.

18 lines (17 loc) 898 B
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); static createInstance(options: ShardingDataSourceOptions): Promise<ShardingManager>; protected init(): Promise<this>; static init(options: ShardingDataSourceOptions): Promise<ShardingManager>; getDataSource(entity: DeepPartial<ShardingBaseEntity>, shardingFunc: Function): DataSource; getDataSourceById(id: unknown, shardingFuncById: Function): DataSource; getDataSourceByShardingKey(key: string): DataSource; destroy(): Promise<void>; }