pg-db-libs
Version:
A TypeScript library for calling PostgreSQL functions and procedures with entity mapping
17 lines (16 loc) • 712 B
TypeScript
export declare class PgEntityMapper {
/**
* Maps a database row to an entity by matching keys to the instance properties.
* @param row The database row to map.
* @param entityInstance An instance of the entity to use for property mapping.
* @returns The mapped entity instance.
*/
static mapToEntity<T extends object>(row: any, entityInstance: T): T;
/**
* Maps a list of rows to entity instances.
* @param rows The list of database rows.
* @param entityInstance An instance of the entity to use for property mapping.
* @returns A list of mapped entity instances.
*/
static mapToEntities<T extends object>(rows: any[], entityInstance: T): T[];
}