Skip to content

Commit 355ddde

Browse files
committed
Improve docs
1 parent b2ab9fb commit 355ddde

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

README.md

+7-8
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ await sql`
3333

3434
## Connection options `postgres([url], [options])`
3535

36-
You can use either a `postgres://` url connection string or the options to define your database connection properties.
36+
You can use either a `postgres://` url connection string or the options to define your database connection properties. Options in the object will override any present in the url.
3737

3838
```js
3939

@@ -64,7 +64,7 @@ const sql = postgres('postgres://username:password@host:port/database', {
6464

6565
```
6666

67-
More info for `ssl` can be found in the [Node.js docs for tls connect options](https://nodejs.org/dist/latest-v10.x/docs/api/tls.html#tls_new_tls_tlssocket_socket_options)
67+
More info for the `ssl` option can be found in the [Node.js docs for tls connect options](https://nodejs.org/dist/latest-v10.x/docs/api/tls.html#tls_new_tls_tlssocket_socket_options)
6868

6969
## Query ```sql` ` -> Promise```
7070

@@ -367,19 +367,18 @@ prexit(async () => {
367367

368368
```
369369

370+
<details><summary><code>sql.unsafe</code> - Advanced unsafe use cases</summary>
370371

371-
## Unsafe queries `sql.unsafe(query, [args], [options]) -> promise`
372+
### Unsafe queries `sql.unsafe(query, [args], [options]) -> promise`
372373

373-
If you know what you're doing, you can use `unsafe` to pass any string you'd like to postgres.
374+
If you know what you're doing, you can use `unsafe` to pass any string you'd like to postgres. Please note that this can lead to sql injection if you're not careful.
374375

375376
```js
376377

377-
sql.unsafe(danger + `
378-
select * from users where id = $1
379-
`, [user_id])
378+
sql.unsafe('select ' + danger + ' from users where id = ' + dragons)
380379

381380
```
382-
381+
</details>
383382

384383
## Errors
385384

0 commit comments

Comments
 (0)