UNPKG

typecql

Version:

ORM for CQL databases.

60 lines (59 loc) 3.03 kB
import { DynamicModule } from '@nestjs/common'; import { Client, DseClientOptions } from 'cassandra-driver'; import { BaseRepository } from './repositories/base-repository'; import { LoggingOptions } from './misc/logging/logging.types'; export type RootOptions = { camelCaseEnabled?: boolean; autoCreateColumns?: boolean; logging?: LoggingOptions; autoCreateTables?: boolean; connectionName?: string; } & DseClientOptions; export declare class TypeCQLModule { /** * @description (NestJS) Creates new connection client and registers it to NestJS Dependency Injection. * @param options Object with settings. * @link https://typecql.com#Installation%20(NestJS) * @link https://typecql.com#Installation%20(NestJS)%20with%20multiple%20clients */ static forRoot(options: RootOptions): Promise<DynamicModule>; /** * @description (NestJS) (Async) Creates new connection client and registers it to NestJS Dependency Injection. * @param options.useFactory Object with settings. * @param options.connectionName Connection name. (ONLY FOR MULTIPLE CONNECTIONS CASE) * @param options.inject NestJS injections array. * @link https://typecql.com#Installation%20(NestJS) * @link https://typecql.com#Installation%20(NestJS)%20with%20multiple%20clients */ static forRootAsync(options: { connectionName?: string; useFactory: (...args: any[]) => Promise<RootOptions> | RootOptions; inject?: any[]; }): Promise<DynamicModule>; /** * @description (General) Creates new connection client and registers it to inner store. * @param options Object with settings. * @return Promise<Client> - Client object. * @link https://typecql.com#Installation%20(TypeScript) * @link https://typecql.com#Installation%20(TypeScript)%20with%20multiple%20clients */ static createClient(options: RootOptions): Promise<Client>; /** * @description (General) Creates new repository from Class with metadata or returns existing. * @param entity Class with prepared metadata. * @param connectionName Connection name (ONLY FOR MULTIPLE CONNECTIONS CASE) * @link https://typecql.com/#Installation%20(TypeScript) * @link https://typecql.com/#Installation%20(TypeScript)%20with%20multiple%20clients * @return */ static getRepository<T extends new (...args: any[]) => any>(entity: T, connectionName?: string): Promise<BaseRepository<InstanceType<T>>>; /** * @description (NestJS) Creates new repositories from Classes with metadata. * @param entities Classes array with prepared metadata. * @param connectionName Name of connection (ONLY FOR MULTIPLE CONNECTIONS CASE) * @link https://typecql.com#Installation%20(NestJS) * @link https://typecql.com#Installation%20(NestJS)%20with%20multiple%20clients */ static forFeature(entities: (new (...args: any[]) => any)[], connectionName?: string): DynamicModule; private static newClient; }