From 1106329c956c943cce7694f736a04e7c85c126ea Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Tue, 10 Dec 2024 23:24:45 -0300 Subject: [PATCH] return hyperloglog value from Relay.Count() --- relay.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/relay.go b/relay.go index 8126422..cff2341 100644 --- a/relay.go +++ b/relay.go @@ -479,12 +479,17 @@ func (r *Relay) QuerySync(ctx context.Context, filter Filter) ([]*Event, error) return events, nil } -func (r *Relay) Count(ctx context.Context, filters Filters, opts ...SubscriptionOption) (int64, error) { +func (r *Relay) Count( + ctx context.Context, + filters Filters, + opts ...SubscriptionOption, +) (int64, []byte, error) { v, err := r.countInternal(ctx, filters, opts...) if err != nil { - return 0, err + return 0, nil, err } - return *v.Count, nil + + return *v.Count, v.HyperLogLog, nil } func (r *Relay) countInternal(ctx context.Context, filters Filters, opts ...SubscriptionOption) (CountEnvelope, error) {