relayer icon indicating copy to clipboard operation
relayer copied to clipboard

passing array of filters to QueryEvents

Open barkyq opened this issue 2 years ago • 2 comments

Was thinking about this lately:

QueryEvents(filter *nostr.Filter) (events []nostr.Event, err error)

could be changed to:

QueryEvents(filters ...nostr.Filter) (events []nostr.Event, err error)

or:

QueryEvents(filters []nostr.Filter) (events []nostr.Event, err error)

so as to enable queries with a single call to SQL (using UNION)... but this would probably break other implementations using the relayer framework.

The current implementation potentially sends duplicate events back to the user (although this could be solved quickly via a deduplication step prior to writing to the websocket). Perhaps the above change would be a more principled solution.

barkyq avatar Jan 20 '23 23:01 barkyq

We should add a new interface for QueryEventsMultiple and use that if available, otherwise use QueryEvents multiple times.

fiatjaf avatar Jan 21 '23 10:01 fiatjaf

good idea

barkyq avatar Jan 22 '23 00:01 barkyq