From 85eaa923d9329ddb2717039a1b90ecd26975c876 Mon Sep 17 00:00:00 2001 From: Angelo Parziale Date: Sun, 31 Mar 2024 09:26:44 +0200 Subject: [PATCH] update: doc for bulk put (#383) --- README.md | 19 ++++++++++++++++++- projects/ngx-indexed-db/README.md | 17 +++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f111dac..7ba6cb2 100644 --- a/README.md +++ b/README.md @@ -193,6 +193,23 @@ this.dbService.bulkGet('people', [1, 3, 5]).subscribe((result) => { }); ``` +### bulkPut(storeName: string, values: Array): Observable + +Adds or updates a record in store with the given value and key. Return all items present in the store + +- @param storeName The name of the store to update +- @param items The values to update in the DB + +@Return The return value is an Observable with the primary key of the object that was last in given array + +@error If the call to bulkPut fails the transaction will be aborted and previously inserted entities will be deleted + +```typescript +this.dbService.bulkPut('people', people).subscribe((result) => { + console.log('result: ', result); +}); +``` + ### update(storeName: string, value: T): Observable Adds or updates a record in store with the given value and key. Return item updated @@ -422,4 +439,4 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d -This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! \ No newline at end of file +This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! diff --git a/projects/ngx-indexed-db/README.md b/projects/ngx-indexed-db/README.md index 51eb739..d6f36db 100644 --- a/projects/ngx-indexed-db/README.md +++ b/projects/ngx-indexed-db/README.md @@ -191,6 +191,23 @@ this.dbService.bulkGet('people', [1, 3, 5]).subscribe((result) => { }); ``` +### bulkPut(storeName: string, values: Array): Observable + +Adds or updates a record in store with the given value and key. Return all items present in the store + +- @param storeName The name of the store to update +- @param items The values to update in the DB + +@Return The return value is an Observable with the primary key of the object that was last in given array + +@error If the call to bulkPut fails the transaction will be aborted and previously inserted entities will be deleted + +```typescript +this.dbService.bulkPut('people', people).subscribe((result) => { + console.log('result: ', result); +}); +``` + ### update(storeName: string, value: T): Observable Adds or updates a record in store with the given value and key. Return item updated