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

db hint #39

Open
vitaly-t opened this issue Jan 19, 2016 · 4 comments
Open

db hint #39

vitaly-t opened this issue Jan 19, 2016 · 4 comments

Comments

@vitaly-t
Copy link

Regarding the code here: https://github.com/radify/collimator/blob/develop/src/util/fileQuery.js

see Query Files

@wms
Copy link
Collaborator

wms commented Jan 19, 2016

Thanks Vitaly, looks like a very useful feature, and less code to maintain in this library itself. One of the goals for collimator is that it does not list pg-promise as a dependency itself, and instead accepts user-provided Database instance.

So, would it be possible for you to make the QueryFile API available on Database instances too?

@vitaly-t
Copy link
Author

Within pg-promise, Database is one level below, whereas QueryFile is on the root level, and strictly speaking, they are not related.

In fact, there is so much on the root level, I don't know how you can get away from using it :)

One of the most important: pgp.as.format that formats queries. All the custom error types are also on the root level.

None of that is related to Database directly, so no, it is not possible.

@wms
Copy link
Collaborator

wms commented Jan 19, 2016

I understand that - what I meant is that an alias on Database would be helpful.

I appreciate you wanting to avoid mixing tiers like that, so I'll have a think about making pg-promise a dependency on collimator in order to access the top-level QueryFile API that you've provided.

@vitaly-t
Copy link
Author

vitaly-t commented Jun 7, 2016

@warrenseymour this has changed in pg-promise v.4.4.7.

You now have hidden property $config in your db object, with all kinds of useful information that's not even fully available from the library's root, like the promise interface that's being used, for example.

To access type QueryFile you can do:

var QueryFile = db.$config.pgp.QueryFile;

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

No branches or pull requests

2 participants