internal

package
v0.17.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2026 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchSizePerNumberOfQueries added in v0.14.0

func BatchSizePerNumberOfQueries(totalFilterLimit int, numberOfQueries int) int

BatchSizePerNumberOfQueries tries to make an educated guess for the batch size given the total filter limit and the number of abstract queries we'll be conducting at the same time

func ChooseNarrowestTag

func ChooseNarrowestTag(filter nostr.Filter) (key string, values []string, goodness int)

func CopyMapWithoutKey added in v0.10.1

func CopyMapWithoutKey[K comparable, V any](originalMap map[K]V, key K) map[K]V

func IsOlder added in v0.14.2

func IsOlder(previous, next *nostr.Event) bool

func NoEvents added in v0.17.15

func NoEvents() chan *nostr.Event

NoEvents returns an already closed channel, for a query that matches nothing.

func SanitizeFilter added in v0.17.15

func SanitizeFilter(filter nostr.Filter) (sanitized nostr.Filter, unsatisfiable bool)

SanitizeFilter reconciles a filter with NIP-01 (and nostr.Filter.Matches) before a backend translates it into its own query, which usually only knows "no list" and "one or more values":

  • a non-nil but empty ids, authors, kinds or tag value list can never be satisfied, so the filter matches nothing and the caller must return no events instead of treating the list as absent;
  • a nil tag value list (e.g. {"#e": null}) is no constraint at all, so it is dropped.

func SanitizeFilters added in v0.17.15

func SanitizeFilters(filters nostr.Filters) nostr.Filters

SanitizeFilters applies SanitizeFilter to each filter and leaves out the unsatisfiable ones, which cannot add anything to a union of the filters.

func SwapDelete added in v0.14.0

func SwapDelete[A any](arr []A, i int) []A

Types

type IterEvent added in v0.14.0

type IterEvent struct {
	*nostr.Event
	Q int
}

func MergeSortMultiple added in v0.14.0

func MergeSortMultiple(batches [][]IterEvent, limit int, dst []IterEvent) []IterEvent

MergeSortMultipleBatches takes the results of multiple iterators, which are already sorted, and merges them into a single big sorted slice

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL