Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( IDs = by("ids") Kinds = by("kinds") Authors = by("authors") Since = by("since") Until = by("until") Limit = by("limit") Search = by("search") )
Functions ¶
Types ¶
type T ¶
type T struct { IDs *tag.T `json:"ids,omitempty"` Kinds *kinds.T `json:"kinds,omitempty"` Authors *tag.T `json:"authors,omitempty"` Tags *tags.T `json:"-,omitempty"` Since *timestamp.T `json:"since,omitempty"` Until *timestamp.T `json:"until,omitempty"` Search by `json:"search,omitempty"` Limit *uint `json:"limit,omitempty"` }
T is the primary query form for requesting events from a nostr relay.
The ordering of fields of filters is not specified as in the protocol there is no requirement to generate a hash for fast recognition of identical filters. However, for internal use in a relay, by applying a consistent sort order, this library will produce an identical JSON from the same *set* of fields no matter what order they were provided.
This is to facilitate the deduplication of filters so an effective identical match is not performed on an identical filter.
func (*T) Clone ¶
Clone creates a new filter with all the same elements in them, because they are immutable, basically, except setting the Limit field as 1, because it is used in the subscription management code to act as a reference counter, and making a clone implicitly means 1 reference.
func (*T) Fingerprint ¶
Fingerprint returns an 8 byte truncated sha256 hash of the filter in the canonical form created by Marshal.
This hash is generated via the JSON encoded form of the filter, with the Limit field removed. This value should be set to zero after all results from a query of stored events, as per NIP-01.