nukak
Version:
flexible and efficient ORM, with declarative JSON syntax and smart type-safety
32 lines (31 loc) • 2.54 kB
TypeScript
import type { IdValue, Querier, Query, QueryOptions, QuerySelect, QuerySearch, RelationKey, Repository, Type, QueryOne, QueryConflictPaths, QueryUpdateResult } from '../type/index.js';
export declare abstract class AbstractQuerier implements Querier {
findOneById<E>(entity: Type<E>, id: IdValue<E>, q?: QueryOne<E>): Promise<E>;
findOne<E>(entity: Type<E>, q: QueryOne<E>): Promise<E>;
abstract findMany<E>(entity: Type<E>, q: Query<E>): Promise<E[]>;
findManyAndCount<E>(entity: Type<E>, q: Query<E>): Promise<[E[], number]>;
abstract count<E>(entity: Type<E>, q: QuerySearch<E>): Promise<number>;
insertOne<E>(entity: Type<E>, payload: E): Promise<IdValue<E>>;
abstract insertMany<E>(entity: Type<E>, payload: E[]): Promise<IdValue<E>[]>;
updateOneById<E>(entity: Type<E>, id: IdValue<E>, payload: E): Promise<number>;
abstract updateMany<E>(entity: Type<E>, q: QuerySearch<E>, payload: E): Promise<number>;
abstract upsertOne<E>(entity: Type<E>, conflictPaths: QueryConflictPaths<E>, payload: E): Promise<QueryUpdateResult>;
deleteOneById<E>(entity: Type<E>, id: IdValue<E>, opts?: QueryOptions): Promise<number>;
abstract deleteMany<E>(entity: Type<E>, q: QuerySearch<E>, opts?: QueryOptions): Promise<number>;
saveOne<E>(entity: Type<E>, payload: E): Promise<IdValue<E> | E[import("../type/entity.js").IdKey<E>]>;
saveMany<E>(entity: Type<E>, payload: E[]): Promise<(Awaited<IdValue<E>> | Awaited<E[import("../type/entity.js").IdKey<E>]>)[]>;
protected fillToManyRelations<E>(entity: Type<E>, payload: E[], select: QuerySelect<E>): Promise<void>;
protected putChildrenInParents<E>(parents: E[], children: E[], parentIdKey: string, referenceKey: string, relKey: string): void;
protected insertRelations<E>(entity: Type<E>, payload: E[]): Promise<void>;
protected updateRelations<E>(entity: Type<E>, q: QuerySearch<E>, payload: E): Promise<void>;
protected deleteRelations<E>(entity: Type<E>, ids: IdValue<E>[], opts?: QueryOptions): Promise<void>;
protected saveRelation<E>(entity: Type<E>, payload: E, relKey: RelationKey<E>, isUpdate?: boolean): Promise<void>;
getRepository<E>(entity: Type<E>): Repository<E>;
abstract readonly hasOpenTransaction: boolean;
transaction<T>(callback: () => Promise<T>): Promise<T>;
releaseIfFree(): Promise<void>;
abstract beginTransaction(): Promise<void>;
abstract commitTransaction(): Promise<void>;
abstract rollbackTransaction(): Promise<void>;
abstract release(): Promise<void>;
}