From 9199ea24243bd9155bb90cea4afd23a8ac3c1daa Mon Sep 17 00:00:00 2001 From: Olena Date: Wed, 30 Aug 2023 17:23:43 +0200 Subject: [PATCH 1/2] Update example of crud style api --- node.js/core-services.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/node.js/core-services.md b/node.js/core-services.md index ef88b2d81..1184292d7 100644 --- a/node.js/core-services.md +++ b/node.js/core-services.md @@ -1080,12 +1080,12 @@ As an alternative to [`srv.run(query)`](#srv-run-query) you can use these conven Essentially, they start constructing *bound* [`cds.ql` query objects](cds-ql) as follows: ```js -srv.read('Books',...)... --> SELECT.from ('Books',...)... -srv.create('Books',...)... --> INSERT.into ('Books',...)... -srv.insert('Books',...)... --> INSERT.into ('Books',...)... -srv.upsert('Books',...)... --> UPSERT.into ('Books',...)... -srv.update('Books',...)... --> UPDATE.entity ('Books',...)... -srv.delete('Books',...)... --> DELETE.from ('Books',...)... +srv.read('Books',...)... --> SELECT.from ('Books',...)... +srv.create('Books',...)... --> INSERT.into ('Books',...)... +srv.insert(...).into('Books')... --> INSERT.into ('Books',...)... +srv.upsert(...).into('Books')... --> UPSERT.into ('Books',...)... +srv.update('Books',...)... --> UPDATE.entity ('Books',...)... +srv.delete('Books',...)... --> DELETE.from ('Books',...)... ``` You can further construct the queries using the `cds.ql` fluent APIs, and then `await` them for execution thru `this.run()`. Here are some examples: From b4488e6ab3a52cded6d4ef6b4a4e667f5fe80e26 Mon Sep 17 00:00:00 2001 From: Olena Date: Fri, 1 Sep 2023 15:35:06 +0200 Subject: [PATCH 2/2] review fix --- node.js/core-services.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node.js/core-services.md b/node.js/core-services.md index 1184292d7..205900800 100644 --- a/node.js/core-services.md +++ b/node.js/core-services.md @@ -1072,8 +1072,8 @@ As an alternative to [`srv.run(query)`](#srv-run-query) you can use these conven - srv. **read** (entity, ...) {.method} - srv. **create** (entity, ...) {.method} -- srv. **insert** (entity, ...) {.method} -- srv. **upsert** (entity, ...) {.method} +- srv. **insert** (...).into(entity) {.method} +- srv. **upsert** (...).into(entity) {.method} - srv. **update** (entity, ...) {.method} - srv. **delete** (entity, ...) {.method}