UNPKG

typeorm-sharding-repository

Version:

TypeORM Sharding Repository: Enables TypeORM to be utilized in a distributed database environment.

85 lines (84 loc) 4.96 kB
import { DataSource, DeepPartial, DeleteResult, EntityManager, FindManyOptions, FindOneOptions, FindOptionsWhere, ObjectID, RemoveOptions, Repository, SaveOptions, UpdateResult } from 'typeorm'; import { QueryDeepPartialEntity } from 'typeorm/query-builder/QueryPartialEntity'; export declare class ShardingBaseEntity { private base; save(options?: SaveOptions): Promise<this>; remove(options?: RemoveOptions): Promise<this>; softRemove(options?: SaveOptions): Promise<this>; recover(options?: SaveOptions): Promise<this>; reload(): Promise<void>; private static wrapArray; static save<T extends ShardingBaseEntity>(this: { new (): T; } & typeof ShardingBaseEntity, entities: DeepPartial<T>[], options?: SaveOptions): Promise<T[]>; static save<T extends ShardingBaseEntity>(this: { new (): T; } & typeof ShardingBaseEntity, entity: DeepPartial<T>, options?: SaveOptions): Promise<T>; static create<T extends ShardingBaseEntity>(this: { new (): T; } & typeof ShardingBaseEntity, entityLikeArray: DeepPartial<T>[]): T[]; static create<T extends ShardingBaseEntity>(this: { new (): T; } & typeof ShardingBaseEntity, entityLike?: DeepPartial<T>): T; static remove<T extends ShardingBaseEntity>(this: { new (): T; } & typeof ShardingBaseEntity, entities: T[], options?: RemoveOptions): Promise<T[]>; static remove<T extends ShardingBaseEntity>(this: { new (): T; } & typeof ShardingBaseEntity, entity: T, options?: RemoveOptions): Promise<T>; static softRemove<T extends ShardingBaseEntity>(this: { new (): T; } & typeof ShardingBaseEntity, entities: T[], options?: SaveOptions): Promise<T[]>; static softRemove<T extends ShardingBaseEntity>(this: { new (): T; } & typeof ShardingBaseEntity, entity: T, options?: SaveOptions): Promise<T>; static update<T extends ShardingBaseEntity>(this: { new (): T; } & typeof ShardingBaseEntity, criteria: string | string[] | number | number[] | Date | Date[] | ObjectID | ObjectID[] | FindOptionsWhere<T>, partialEntity: QueryDeepPartialEntity<T>): Promise<UpdateResult>; static delete<T extends ShardingBaseEntity>(this: { new (): T; } & typeof ShardingBaseEntity, criteria: string | string[] | number | number[] | Date | Date[] | ObjectID | ObjectID[] | FindOptionsWhere<T>): Promise<DeleteResult>; static count<T extends ShardingBaseEntity>(this: { new (): T; } & typeof ShardingBaseEntity, options?: FindManyOptions<T>): Promise<number>; static countBy<T extends ShardingBaseEntity>(this: { new (): T; } & typeof ShardingBaseEntity, where: FindOptionsWhere<T>): Promise<number>; static find<T extends ShardingBaseEntity>(this: { new (): T; } & typeof ShardingBaseEntity, options?: FindManyOptions<T>): Promise<T[]>; static findBy<T extends ShardingBaseEntity>(this: { new (): T; } & typeof ShardingBaseEntity, where: FindOptionsWhere<T>): Promise<T[]>; static findAndCount<T extends ShardingBaseEntity>(this: { new (): T; } & typeof ShardingBaseEntity, options?: FindManyOptions<T>): Promise<[T[], number]>; static findAndCountBy<T extends ShardingBaseEntity>(this: { new (): T; } & typeof ShardingBaseEntity, where: FindOptionsWhere<T>): Promise<[T[], number]>; static findByIds<T extends ShardingBaseEntity>(this: { new (): T; } & typeof ShardingBaseEntity, ids: any[]): Promise<T[]>; static findOne<T extends ShardingBaseEntity>(this: { new (): T; } & typeof ShardingBaseEntity, options: FindOneOptions<T>): Promise<T | null | undefined>; static findOneBy<T extends ShardingBaseEntity>(this: { new (): T; } & typeof ShardingBaseEntity, where: FindOptionsWhere<T>): Promise<T | null | undefined>; static findOneById<T extends ShardingBaseEntity>(this: { new (): T; } & typeof ShardingBaseEntity, id: string | number | Date | ObjectID): Promise<T | null>; /************************************************/ private static _shardingManager; private static shardingManager; private static _shardingFunc; private static shardingFunc; private static _shardingFuncById; private static shardingFuncById; static getAllRepository<T extends ShardingBaseEntity = ShardingBaseEntity>(): Repository<T>[]; static getRepository<T extends ShardingBaseEntity = ShardingBaseEntity>(entity: DeepPartial<T>): Repository<T>; static getManager<T extends ShardingBaseEntity = ShardingBaseEntity>(entity: DeepPartial<T>): EntityManager; static getAllDataSource<T extends ShardingBaseEntity = ShardingBaseEntity>(): DataSource[]; static getDataSource<T extends ShardingBaseEntity = ShardingBaseEntity>(entity: DeepPartial<T>): DataSource; static getDataSourceById<T extends ShardingBaseEntity = ShardingBaseEntity>(id: unknown): DataSource; }