All files / src tables.entities.map.ts

100% Statements 7/7
100% Branches 4/4
100% Functions 6/6
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28    3x   25x       7x       3x       2x       19x     3x        
'use strict';
 
export default class PostgresTablesEntitiesMap {
	public static addTableToEntityMapping(tableName: string, entity: any): void {
		PostgresTablesEntitiesMap._entities.set(tableName, entity);
	}
 
	public static getEntityByTable(tableName: string): any | null {
		return PostgresTablesEntitiesMap._entities.get(tableName) ?? null;
	}
 
	public static keys(): string[] {
		return Array.from(PostgresTablesEntitiesMap._entities.keys());
	}
 
	public static values(): any[] {
		return Array.from(PostgresTablesEntitiesMap._entities.values());
	}
 
	public static clear(): void {
		PostgresTablesEntitiesMap._entities.clear();
	}
 
	private static readonly _entities: Map<string, any> = new Map<string, any>();
 
	private constructor() {}
}