Skip to content

Commit

Permalink
return hyperloglog value from Relay.Count()
Browse files Browse the repository at this point in the history
  • Loading branch information
fiatjaf committed Dec 11, 2024
1 parent e8d9464 commit 1106329
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 1106329

Please sign in to comment.