import { PoolClient, Pool } from 'pg'; import { Repositories } from './Repositories'; export interface Reader { find(item: Partial): Promise; findOne(id: string | Partial): Promise; } export interface Writer { create(value: Partial): Promise; update(where: Partial, newValue: Partial): Promise; delete(where: Partial): Promise; } export type Repository = Reader & Writer; export type PageResult = { items: T[]; totalCount: number; pageSize: number; }; export type SortDirection = 'desc' | 'asc'; export declare const DEFAULT_PAGE_SIZE = 20; export declare abstract class AbstractRepository implements Reader, Writer { protected repositories: Repositories; protected pool: Pool; protected classRef: { new (data?: Record): DATA_CLASS; }; protected tableName: string; /** object where the key is the model property name amd the value is sql column name */ protected modelPropertyToSqlColumn: { [key in keyof SHAPE]: string; }; /** object where the key is the sql column name and the value is the model property name */ protected sqlColumnToModelProperty: { [key: string]: string; }; constructor(repositories: Repositories, pool: Pool, tableName: string, mapping: { [key in keyof SHAPE]: string; }, classRef: { new (data?: Record): DATA_CLASS; }); protected getConnection(): Promise; private sanitiseValue; create(value: SHAPE, transactionClient?: PoolClient | null): Promise; update(where: Partial, newValue: Exclude, Record>, transactionClient?: PoolClient | null): Promise; delete(where: Partial, transactionClient?: PoolClient | null): Promise; protected createWhereStringFromPartialModel(values: Partial, initialIndex?: number): string; protected executeQueryRaw(query: string, values: any[], transactionClient?: PoolClient | null): Promise; executeQuery(query: string, values: any[], transactionClient?: PoolClient | null): Promise; protected createAndHydrateModel(row: any): SHAPE; findOne(item: Partial, transactionClient?: PoolClient): Promise; find(item: Partial): Promise; findAll(): Promise; getCount(item?: Partial | null): Promise; getPage(pageNumber: number, sortBy?: (keyof SHAPE)[], direction?: SortDirection, pageSize?: number | null, item?: Partial | null): Promise>; getCountRaw(whereClause?: string, values?: any[], tableRef?: string): Promise; getPageRaw(pageNumber: number, sortBy?: (keyof SHAPE)[], direction?: SortDirection, whereClause?: string, tableRef?: string, values?: any[], pageSize?: number | null, searchFields?: Partial | null): Promise>; } //# sourceMappingURL=AbstractRepository.d.ts.map