Skip to content

Commit

Permalink
Merge pull request #297 from utopia-php/add-batch-update-methods
Browse files Browse the repository at this point in the history
Add support for batch creates and updates
  • Loading branch information
abnegate authored Aug 16, 2023
2 parents 1cea72c + 75391ea commit be3a141
Show file tree
Hide file tree
Showing 13 changed files with 1,291 additions and 113 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"php": ">=8.0",
"utopia-php/framework": "0.*.*",
"utopia-php/cache": "0.8.*",
"utopia-php/mongo": "0.0.2"
"utopia-php/mongo": "0.3.*"
},
"require-dev": {
"ext-redis": "*",
Expand Down
287 changes: 192 additions & 95 deletions composer.lock

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions src/Database/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,17 @@ abstract public function getDocument(string $collection, string $id, array $quer
*/
abstract public function createDocument(string $collection, Document $document): Document;

/**
* Create Documents in batches
*
* @param string $collection
* @param Document[] $documents
* @param int $batchSize
*
* @return Document[]
*/
abstract public function createDocuments(string $collection, array $documents, int $batchSize): array;

/**
* Update Document
*
Expand All @@ -305,6 +316,17 @@ abstract public function createDocument(string $collection, Document $document):
*/
abstract public function updateDocument(string $collection, Document $document): Document;

/**
* Update Documents in batches
*
* @param string $collection
* @param Document[] $documents
* @param int $batchSize
*
* @return Document[]
*/
abstract public function updateDocuments(string $collection, array $documents, int $batchSize): array;

/**
* Delete Document
*
Expand Down
Loading

0 comments on commit be3a141

Please sign in to comment.