Skip to content

Commit 02b11ba

Browse files
committed
docs update.
1 parent 3e90ebe commit 02b11ba

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ Example:
488488
```js
489489
// Helper for linking to external query files:
490490
function sql(file) {
491+
// consider using here: path.join(__dirname, file)
491492
return new pgp.QueryFile(file, {minify: true});
492493
}
493494

@@ -504,7 +505,7 @@ db.one(sqlFindUser, {id: 123})
504505
}
505506
});
506507
```
507-
508+
508509
File `findUser.sql`:
509510
```sql
510511
/*

lib/queryFile.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,12 @@ var $npm = {
8787
* // - have your sql provider module as ./sql/index.js
8888
*
8989
* var QueryFile = require('pg-promise').QueryFile;
90+
* var path = require('path');
9091
*
9192
* // Helper for linking to external query files:
9293
* function sql(file) {
93-
* var relativePath = './db/sql/';
94-
* return new QueryFile(relativePath + file, {minify: true});
94+
* var fullPath = path.join(__dirname, file); // generating full path;
95+
* return new QueryFile(fullPath, {minify: true});
9596
* }
9697
*
9798
* var sqlProvider = {

0 commit comments

Comments
 (0)