-
-
Notifications
You must be signed in to change notification settings - Fork 36
feature: native option #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: native option #7
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test are failing, the native library is slightly different from the standard one.
Please put inside the .gitignore the package-lock.json.
|
Oh, damn. I'll investigate. |
Yes, but I prefer keep everything inside here, since the changes to do should be minimal. |
|
updated, it works! |
| let pg = require('pg') | ||
|
|
||
| function fastifyPostgres (fastify, options, next) { | ||
| if (options.native) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are passing the options object to Pool, it's better that we remove the native key from the object.
if (options.native) {
delete options.native
...|
ok, done. Please review also the readme, my english need a review :) |
| Use native `libpq` to gain high performance; it will use [pg-native](https://github.com/brianc/node-pg-native) instead of [pg](https://github.com/brianc/node-pg). | ||
| Note: it requires PostgreSQL client libraries & tools installed, see | ||
| [instructions](https://github.com/brianc/node-pg-native#install). | ||
| Note: trying to use native options without successfully installation of `pg-native` will get a warning and fallback to regular `pg` module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since pg-native is not in the devDependencies this warn is not needed.
In my opinion we should have pg-native in our devDependencies, in this way the user can actively choose which library use and not install more stuff than needed.
In this way, I'll rephrase the docs as the following:
### Native option
If you want to gain the maximum performances you can install [pg-native](https://github.com/brianc/node-pg-native), and pass `native: true` to the plugin options.
*Note: it requires PostgreSQL client libraries & tools installed, see [instructions](https://github.com/brianc/node-pg-native#install).*
package.json
Outdated
| "pg": "^7.3.0", | ||
| "pg-native": "^2.2.0" | ||
| }, | ||
| "optionalDependencies": {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line can be removed :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Well done! :)
|
Good! Thanks for support! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.