multimeric / koa-pg-session

A model implementation of sessions for koa using postgres as the backend
10 stars 7 forks source link

Incorrect query formatting docs #7

Closed vitaly-t closed 8 years ago

vitaly-t commented 8 years ago

The function must have the signature (query, parameters), where query is a string optionally containing dollar sign parameters ($1, $2 for example), and parameters is an array of values to replace these dollar signs with.

As I understand, you are passing (query, values) into pg-promise. And if so, you should just redirect your documentation to pg-promise, because the latter supports a very wide syntax for both query and values:

query can be:

values can be:

etc...

Basically, there is really a lot to the pair of (query, values) of what it can represent. As I stated earlier, you should just redirect your documentation in this case, not try to re-document anything, as it would be a lot.

multimeric commented 8 years ago

No I think you're misunderstanding this parameter. In this module, all of the queries are run by the module itself, not by the user (to create/read/update/delete the session table). These queries are normally passed into pg-promise, but if the user passes a function here, the queries will be passed into the function instead. This allows them to redirect the queries into their own database driver.

vitaly-t commented 8 years ago

Ok, if you think so. It was just confusing that only "$1, $2" was mentioned, because if it ends up inside pg-promise query formatting, it can be a lot more than that, as explained earlier.

It's up to you. I can close the issue.