adapter

package
v0.0.0-...-128b944 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WordBleveSearchRepository

type WordBleveSearchRepository struct {
	// contains filtered or unexported fields
}

WordBleveSearchRepository is an in-memory implementation of the domain.WordSearchRepository interface.

func NewWordBleveSearchRepository

func NewWordBleveSearchRepository(path string, tracer trace.Tracer) (*WordBleveSearchRepository, error)

NewWordBleveSearchRepository creates a new WordMemorySearchRepository.

func (*WordBleveSearchRepository) Close

func (r *WordBleveSearchRepository) Close() error

Close closes any resources associated with the repository.

func (*WordBleveSearchRepository) IndexWord

func (r *WordBleveSearchRepository) IndexWord(ctx context.Context, word domain.Word) error

IndexWord indexes a new word in the bleve.Index.

func (*WordBleveSearchRepository) SearchWordsByPrefix

func (r *WordBleveSearchRepository) SearchWordsByPrefix(ctx context.Context, prefix string) ([]int, error)

SearchWordsByPrefix returns a list of word ids with a specific prefix in the bleve.Index.

type WordMemoryRepository

type WordMemoryRepository struct {
	// contains filtered or unexported fields
}

WordMemoryRepository is an in-memory implementation of the domain.WordRepository interface.

func NewWordMemoryRepository

func NewWordMemoryRepository(tracer trace.Tracer) (*WordMemoryRepository, error)

NewWordMemoryRepository creates a new WordMemoryRepository.

func (*WordMemoryRepository) AddWord

func (r *WordMemoryRepository) AddWord(ctx context.Context, word string) (*domain.Word, error)

AddWord adds a new word in the words map. TODO(mike): Cater for duplicates?

func (*WordMemoryRepository) Close

func (*WordMemoryRepository) Close() error

Close closes any resources associated with the repository.

func (*WordMemoryRepository) ListWords

func (r *WordMemoryRepository) ListWords(ctx context.Context, params domain.ListWordsParams) ([]domain.Word, error)

ListWords list all the words in the map.

func (*WordMemoryRepository) RandomWord

func (r *WordMemoryRepository) RandomWord(ctx context.Context) (*domain.Word, error)

RandomWord implements domain.WordRepository

Jump to

Keyboard shortcuts

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