mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-06-11 01:10:48 +02:00
return hyperloglog value from Relay.Count()
This commit is contained in:
parent
e8d9464938
commit
1106329c95
11
relay.go
11
relay.go
@ -479,12 +479,17 @@ func (r *Relay) QuerySync(ctx context.Context, filter Filter) ([]*Event, error)
|
|||||||
return events, nil
|
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...)
|
v, err := r.countInternal(ctx, filters, opts...)
|
||||||
if err != nil {
|
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) {
|
func (r *Relay) countInternal(ctx context.Context, filters Filters, opts ...SubscriptionOption) (CountEnvelope, error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user