Skip to content

Commit 211e148

Browse files
author
Uku Pattak
committed
Update placeholders README to have more real-life examples
1 parent 7b5f380 commit 211e148

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,25 @@ Currently just two SQL dialects are supported:
4949

5050
```js
5151
// Named placeholders
52-
sqlFormatter.format("SELECT @foo FROM table1", {
53-
params: {foo: "bar"}
52+
sqlFormatter.format("SELECT * FROM tbl WHERE foo = @foo", {
53+
params: {foo: "'bar'"}
5454
}));
5555

5656
// Indexed placeholders
57-
sqlFormatter.format("SELECT ? FROM table1", {
58-
params: ["bar"]
57+
sqlFormatter.format("SELECT * FROM tbl WHERE foo = ?", {
58+
params: ["'bar'"]
5959
}));
6060
```
6161

6262
Both result in:
6363

6464
```
6565
SELECT
66-
bar
66+
*
6767
FROM
68-
table1
68+
tbl
69+
WHERE
70+
foo = 'bar'
6971
```
7072

7173
## Usage without NPM

0 commit comments

Comments
 (0)