Documentation ¶
Index ¶
- type WordBleveSearchRepository
- type WordMemoryRepository
- func (r *WordMemoryRepository) AddWord(ctx context.Context, word string) (*domain.Word, error)
- func (*WordMemoryRepository) Close() error
- func (r *WordMemoryRepository) ListWords(ctx context.Context, params domain.ListWordsParams) ([]domain.Word, error)
- func (r *WordMemoryRepository) RandomWord(ctx context.Context) (*domain.Word, error)
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) 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 ¶
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 ¶
RandomWord implements domain.WordRepository