UNPKG

@blueleader07/typeorm

Version:

Data-Mapper ORM for TypeScript, ES7, ES6, ES5. Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, MongoDB databases.

81 lines (80 loc) 4.59 kB
/** * Entity manager supposed to work with any entity, automatically find its repository and call its methods, * whatever entity type are you passing. * * This implementation is used for DynamoDB driver which has some specifics in its EntityManager. */ import { EntityManager } from "./EntityManager"; import { EntityTarget } from "../common/EntityTarget"; import { ObjectID } from "../driver/mongodb/typings"; import { ObjectLiteral } from "../common/ObjectLiteral"; import { FindOneOptions } from "../find-options/FindOneOptions"; import { DeepPartial } from "../common/DeepPartial"; import { QueryDeepPartialEntity } from "../query-builder/QueryPartialEntity"; import { DeleteResult } from "../query-builder/result/DeleteResult"; import { DynamoQueryRunner } from "../driver/dynamo/DynamoQueryRunner"; import { DynamoUpdateExpressionOptions } from "../driver/dynamo/models/DynamoUpdateExpressionOptions"; import { DynamoFindOptions } from "../driver/dynamo/models/DynamoFindOptions"; import { FindOptionsWhere } from "../find-options/FindOptionsWhere"; import { DynamoScanOptions } from "../driver/dynamo/models/DynamoScanOptions"; import { DynamoBatchWriteItem } from "../driver/dynamo/models/DynamoBatchWriteItem"; import { DataSource } from "../data-source"; export declare class DynamoEntityManager extends EntityManager { get dynamodbQueryRunner(): DynamoQueryRunner; constructor(connection: DataSource); createDefaultKeyMapper<Entity>(target: EntityTarget<Entity>): (entity: ObjectLiteral) => any; update<Entity>(entityClassOrName: EntityTarget<Entity>, options: DynamoUpdateExpressionOptions): Promise<any>; /** * Finds entities that match given find options or conditions. */ find<Entity>(entityClassOrName: EntityTarget<Entity>, options?: DynamoFindOptions | any): Promise<Entity[]>; /** * Finds entities that match given find options or conditions. */ findAll<Entity>(entityClassOrName: EntityTarget<Entity>, options: DynamoFindOptions): Promise<Entity[]>; scan<Entity>(entityClassOrName: EntityTarget<Entity>, options: DynamoScanOptions): Promise<any>; /** * Finds first entity that matches given conditions and/or find options. */ findOne<Entity>(entityClass: EntityTarget<Entity>, options: FindOneOptions<Entity>): Promise<Entity | null>; /** * Finds first entity that matches given conditions and/or find options. */ findOneBy<Entity>(entityClass: EntityTarget<Entity>, options: FindOptionsWhere<Entity>): Promise<Entity | null>; /** * Put a given entity into the database. * Unlike save method executes a primitive operation without cascades, relations and other operations included. * Executes fast and efficient INSERT query. * Does not check if entity exist in the database, so query will fail if duplicate entity is being inserted. * You can execute bulk inserts using this method. */ put<Entity>(target: EntityTarget<Entity>, entity: DeepPartial<Entity> | DeepPartial<Entity>[]): Promise<any | any[]>; delete<Entity>(targetOrEntity: EntityTarget<Entity>, criteria: string | string[] | number | number[] | Date | Date[] | ObjectID | ObjectID[] | any): Promise<DeleteResult>; deleteAll<Entity>(target: EntityTarget<Entity>, options: DynamoFindOptions, keyMapper?: any): Promise<void>; deleteAllBy<Entity>(target: EntityTarget<Entity>, options: DynamoFindOptions, keyMapper?: any): Promise<void>; deleteQueryBatch<Entity>(target: EntityTarget<Entity>, options: DynamoFindOptions, keyMapper?: any): Promise<void>; /** * Delete multiple documents on DynamoDB. */ deleteMany<Entity>(entityClassOrName: EntityTarget<Entity>, keys: QueryDeepPartialEntity<Entity>[]): Promise<void>; /** * Delete a document on DynamoDB. */ deleteOne<Entity>(entityClassOrName: EntityTarget<Entity>, key: ObjectLiteral): Promise<void>; /** * Put an array of documents into DynamoDB. */ putMany<Entity>(entityClassOrName: EntityTarget<Entity>, docs: ObjectLiteral[]): Promise<void>; /** * Put a single document into DynamoDB. */ putOne<Entity>(entityClassOrName: EntityTarget<Entity>, doc: ObjectLiteral): Promise<ObjectLiteral>; /** * Read from DynamoDB in batches. */ batchRead<Entity>(entityClassOrName: EntityTarget<Entity>, keys: ObjectLiteral[]): Promise<any[]>; /** * Put an array of documents into DynamoDB in batches. */ batchWrite<Entity>(entityClassOrName: EntityTarget<Entity>, writes: DynamoBatchWriteItem[]): Promise<void>; }