search

package module
v0.0.0-...-6deb74b Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Autocompleter

type Autocompleter[T Entry] struct {
	// contains filtered or unexported fields
}

func NewAutocompleter

func NewAutocompleter[T Entry](idx TagIndex[T]) *Autocompleter[T]

func (Autocompleter[_]) Autocomplete

func (a Autocompleter[_]) Autocomplete(tags []string, limit int) ([][]TagInfo, error)

type Entry

type Entry interface {
	ID() string
	Tags() []string
}

type OrderedEntry

type OrderedEntry interface {
	Entry
	Order() int64
}

type QueryResult

type QueryResult[T any] struct {
	Data       []T
	TotalCount int
}

func (QueryResult[T]) Page

func (qr QueryResult[T]) Page(cursor string, limit int) ([]T, string)

func (*QueryResult[_]) Reset

func (qr *QueryResult[_]) Reset()

type ShardedTagIndex

type ShardedTagIndex[T Entry] struct {
	// contains filtered or unexported fields
}

func NewShardedTagIndex

func NewShardedTagIndex[T Entry](
	numShards int32, shardInitFn func(n int32) TagIndex[T],
) ShardedTagIndex[T]

func (ShardedTagIndex[_]) Commit

func (sti ShardedTagIndex[_]) Commit() error

Commit does nothing at the moment, sub-index commit is called lazily when querying

func (ShardedTagIndex[T]) Get

func (sti ShardedTagIndex[T]) Get(id ...string) ([]T, error)

func (ShardedTagIndex[T]) Put

func (sti ShardedTagIndex[T]) Put(e ...T)

func (ShardedTagIndex[T]) Query

func (sti ShardedTagIndex[T]) Query(dst *QueryResult[T], tags []string, limit int) error

func (ShardedTagIndex[_]) Tags

func (sti ShardedTagIndex[_]) Tags(prefix string) ([]TagInfo, error)

func (ShardedTagIndex[T]) WithSeed

func (sti ShardedTagIndex[T]) WithSeed(seed int64) ShardedTagIndex[T]

type TagIndex

type TagIndex[T Entry] interface {
	Get(id ...string) ([]T, error)
	Query(dst *QueryResult[T], tags []string, limit int) error
	Put(e ...T)
	Commit() error
	Tags(prefix string) ([]TagInfo, error)
}

func NewMemoryTagIndex

func NewMemoryTagIndex[T Entry]() TagIndex[T]

type TagInfo

type TagInfo struct {
	Tag   string
	Count int
}

Jump to

Keyboard shortcuts

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