UNPKG

vyndra-js

Version:

Micro Node.js framework with routing, ORM, decorators, and automatic DI

20 lines (19 loc) 730 B
export declare class CrudRepository<T extends { id: any; }> { private readonly entityClass; table: any; protected db: import("drizzle-orm/node-postgres").NodePgDatabase<Record<string, unknown>> & { $client: import("pg").Pool; }; constructor(entityClass: new (init?: Partial<T>) => T); private ensureTableExists; private unwrapRows; findAll(): Promise<T[]>; findById(id: number): Promise<T | null>; findByField(field: keyof T, value: any): Promise<T[]>; save(entity: T): Promise<T>; update(id: number, partial: Partial<T>): Promise<T | null>; delete(id: number): Promise<boolean>; query(queryText: string, params?: any[] | Record<string, any>): Promise<any[]>; }