mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-09-08 16:33:38 +02:00
move nostr-sdk repository into here because why not?
This commit is contained in:
24
sdk/search.go
Normal file
24
sdk/search.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package sdk
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/nbd-wtf/go-nostr"
|
||||
)
|
||||
|
||||
func (sys *System) SearchUsers(ctx context.Context, query string) []ProfileMetadata {
|
||||
limit := 10
|
||||
profiles := make([]ProfileMetadata, 0, limit*len(sys.UserSearchRelays))
|
||||
|
||||
for ie := range sys.Pool.SubManyEose(ctx, sys.UserSearchRelays, nostr.Filters{
|
||||
{
|
||||
Search: query,
|
||||
Limit: limit,
|
||||
},
|
||||
}) {
|
||||
m, _ := ParseMetadata(ie.Event)
|
||||
profiles = append(profiles, m)
|
||||
}
|
||||
|
||||
return profiles
|
||||
}
|
Reference in New Issue
Block a user