Skip to content
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

Support passing pg-promise initialization options during the library's initialization #94

Open
jackh726 opened this issue Jun 19, 2018 · 5 comments

Comments

@jackh726
Copy link

It would be nice to be able to pass initialization options or a configuration object directly to pg-promise.

This could be fairly easily be possible if you

  1. Allow either a PgPromise.IDatabase or a string directly to be passed to the PostgresDatabase constructor.
  2. Export PostgresDatabase from index (should also maybe export MysqlDatabase too)

In general, it might be worth double checking to see if there are other useful classes/functions that should be exported too.

@xiamx
Copy link
Contributor

xiamx commented Jun 20, 2018

I think allowing the constructor to be extended with options is a good choice. Please make a pull request and let's look at it together. Also could you elaborate on what you want to build on top of schemats, I'm very curious.

@vitaly-t
Copy link
Contributor

vitaly-t commented Jun 21, 2018

Also could you elaborate on what you want to build on top of schemats, I'm very curious.

My sentiment exactly, what options of pg-promise is he planning to use that would be beneficial here?

@jackh726
Copy link
Author

@xiamx I actually have (at least for now) decided that this is a bit heavy for me to implement/use (for now, at least), and I can't really devote time to make a pull request currently, sorry.

I was planning to use this to generate types during build/development. The project I work on has some special logic for getting the database configuration, and use that as a configuration object for pg-promise in the main source.

I didn't have a specific idea for initialization options though.

As I said, I won't be using this right now, so feel free to close this issue if you don't think it's needed.

@xiamx xiamx changed the title Expand support for access as a library Support passing pg-promise initialization options during the library's initialization Jun 22, 2018
@xiamx
Copy link
Contributor

xiamx commented Jun 22, 2018

Cool so I changed the title to a more descriptive one. We will keep this one open for visibility.

@vitaly-t
Copy link
Contributor

vitaly-t commented Jun 22, 2018

@xiamx It's nice, but I don't see it being of any use, because this library is only used for generating code, and all the options in pg-promise relate to the run-time in-app usage only, nothing to do with the code generation. I don't understand why this issue was open to begin with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants