cnpmcore
Version:
Private NPM Registry for Enterprise
22 lines (21 loc) • 724 B
TypeScript
import type { EntityData } from '../entity/Entity.ts';
type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
export type EasyData<T extends EntityData, Id extends keyof T> = PartialBy<T, 'createdAt' | 'updatedAt' | Id>;
export interface PageOptions {
pageSize?: number;
pageIndex?: number;
}
export interface PageResult<T> {
count: number;
data: T[];
}
export interface PageLimitOptions {
offset: number;
limit: number;
}
export declare class EntityUtil {
static defaultData<T extends EntityData, Id extends keyof T>(data: EasyData<T, Id>, id: Id): T;
static createId(): string;
static convertPageOptionsToLimitOption(page: PageOptions): PageLimitOptions;
}
export {};