Skip to content

Commit e8ca886

Browse files
committed
docs: update example
1 parent 08e8c65 commit e8ca886

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

packages/kysely-driver/README.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -147,21 +147,7 @@ const result = await db.selectFrom('users').select('name').executeTakeFirstOrThr
147147
// 'James Smith'
148148
```
149149

150-
- In PowerSync
151-
152-
```js
153-
await powerSyncDb.writeTransaction((transaction) => {
154-
await transaction.execute('INSERT INTO users (id, name) VALUES(4, ?)', ['James']);
155-
await transaction.execute("UPDATE users SET name = ? WHERE name = ?", ['James Smith', 'James']);
156-
})
157-
const result = await powerSyncDb.get('SELECT name FROM users WHERE name = ?', ['James Smith'])
158-
159-
// 'James Smith'
160-
```
161-
162-
### Transaction with raw SQL
163-
164-
- In Kysely
150+
- In Kysely also using raw SQL
165151

166152
```js
167153
await db.transaction().execute(async (transaction) => {
@@ -177,7 +163,7 @@ const result = await db.selectFrom('users').select('name').executeTakeFirstOrThr
177163

178164
```js
179165
await powerSyncDb.writeTransaction((transaction) => {
180-
await sql`INSERT INTO users (id, name) VALUES ('4', 'James');`.execute(transaction)
166+
await transaction.execute('INSERT INTO users (id, name) VALUES(4, ?)', ['James']);
181167
await transaction.execute("UPDATE users SET name = ? WHERE name = ?", ['James Smith', 'James']);
182168
})
183169
const result = await powerSyncDb.get('SELECT name FROM users WHERE name = ?', ['James Smith'])

0 commit comments

Comments
 (0)