Skip to content

Commit 728fc2c

Browse files
committed
split example query in two lines
1 parent e83cce0 commit 728fc2c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ pg.query(SQL`SELECT author FROM books WHERE name = ${book}`);
1818
This might not seem like a big deal, but when you do an INSERT with a lot columns writing all the placeholders becomes a nightmare:
1919

2020
```js
21-
db.query('INSERT INTO books (name, author, isbn, category, recommended_age, pages, price) VALUES (?, ?, ?, ?, ?, ?, ?)', [name, author, isbn, category, recommendedAge, pages, price]);
21+
db.query(
22+
'INSERT INTO books (name, author, isbn, category, recommended_age, pages, price) VALUES (?, ?, ?, ?, ?, ?, ?)',
23+
[name, author, isbn, category, recommendedAge, pages, price]
24+
);
2225
// is equivalent to
2326
db.query(SQL`
2427
INSERT

0 commit comments

Comments
 (0)