Add example of TS/JS transaction w/ querybuilder
@@ -42,12 +42,25 @@ under the hood.
TypeScript/JS
^^^^^^^^^^^^^
+Using an EdgeQL query string:
+
.. code-block:: typescript
client.transaction(async tx => {
await tx.execute(`insert Fish { name := 'Wanda' };`);
});
+Using the querybuilder:
+
+.. code-block:: typescript
+
+ const query = e.insert(e.Fish, {
+ name: 'Wanda'
+ });
+ client.transaction(async tx => {
+ await query.run(tx);
+ });
+
Full documentation at `Client Libraries > TypeScript/JS
</docs/clients/01_js/index>`_;
