On Wed, Jun 15, 2022 at 09:22:37PM +0000, Hamid Maadani wrote:

> This is good, was unaware of the multi-row result standard.
> How does this work with other DBs? for example, if you have two result sets:
> { "name": "hamid", "value": "test" }
> { "name": "viktor", "value": "test2" }

Well, Postfix dictionaries cannot meaningfully consume structured data,
you can return a single value, or a comma-separated list.  If it is a
list of email addresses, they should be stored in "external form"
(RFC-5322 quoted) allowing robust parsing as a comma-separated list of
such quoted forms).

Thus "name" might be the key, and "value" the desired value column,
so that a query for "hamid" would return "test", and a query for
"viktor" would return "test2".

But if the database also held:

    { "name": "devs", "value": "wietse" }
    { "name": "devs", "value": "viktor" }
    { "name": "devs", "value": "hamid" }

then a query for "devs" would return:

    wietse,viktor,hamid



> should it return as below?
> hamid,test,viktor,test2

So definitely not this, it makes no sense.

> Regarding the 'db_common_expand' line, I used the same function used for the 
> SQL dict,
> to support expansions like %s , %u and such for mongodb search filter, if 
> that makes sense.

Yes, "%s", "%u" and "%d" are reasonably expected.

You should also support the "domain" attribute to limit the keys sent to
the database to just email addresses with a domain part matching one of
the elements of that list.

-- 
    Viktor.

Reply via email to