typeorm-extension
Version:
A library to create/drop database, simple seeding data sets, ...
29 lines (28 loc) • 719 B
TypeScript
import type { DataSource, EntityTarget, ObjectLiteral } from 'typeorm';
type EntityUniquenessCheckOptions<T> = {
/**
* Repository entity class.
*/
entityTarget: EntityTarget<T>;
/**
* Entity to insert/update.
*/
entity: Partial<T>;
/**
* Entity found.
*/
entityExisting?: Partial<T> | null;
/**
* DataSource to use
*/
dataSource?: DataSource;
};
/**
* Check if a given entity does not already exist.
* Composite unique keys on a null column can only be present once.
*
* @experimental
* @param options
*/
export declare function isEntityUnique<T extends ObjectLiteral>(options: EntityUniquenessCheckOptions<T>): Promise<boolean>;
export {};