import type { GraphObject } from 'jsonld'; import type { Frame } from 'jsonld/jsonld-spec'; import type { Entity } from '../util/Types'; import type { FindAllOptions, FindOneOptions, FindOptionsWhere } from './FindOptionsTypes'; export declare type RawQueryResult = Record; /** * Adapts SKQL CRUD operations to a specific persistence layer. */ export interface QueryAdapter { /** * Performs a raw query for data matching the query. */ executeRawQuery(query: string): Promise; /** * Performs a raw query for entities matching the query. The query must be a CONSTRUCT query. */ executeRawEntityQuery(query: string, frame?: Frame): Promise; /** * Finds first entity by a given find options. * If entity was not found in the database - returns null. */ find(options?: FindOneOptions): Promise; /** * Finds first entity that matches given where condition. * If entity was not found in the database - returns null. */ findBy(where: FindOptionsWhere): Promise; /** * Finds entities that match given find options. */ findAll(options?: FindAllOptions): Promise; /** * Finds entities that match given where condition. */ findAllBy(where: FindOptionsWhere): Promise; /** * Determines if an entity matching the given where condition exists in the database. */ exists(where?: FindOptionsWhere): Promise; /** * Returns a count of entities matching the given where condition in the database. */ count(where?: FindOptionsWhere): Promise; /** * Saves a given entity in the database. * If entity does not exist in the database then inserts, otherwise updates. */ save(entity: Entity): Promise; /** * Saves all given entities in the database. * If entities do not exist in the database then inserts, otherwise updates. */ save(entities: Entity[]): Promise; /** * Updates entity partially. Entity can be found by a given conditions. * Unlike save method executes a primitive operation without cascades, relations and other operations included */ /** * Removes a given entity from the database. */ destroy(entity: Entity): Promise; /** * Removes given entities from the database. */ destroy(entities: Entity[]): Promise; /** * Deletes entities by a given criteria. * Unlike destroy method executes a primitive operation without cascades, relations and other operations included. */ /** * Removes all entities from the database. */ destroyAll(): Promise; }