repository

package
v0.0.0-...-c8e808c Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InMememoryRepository

type InMememoryRepository struct {
	// Store holds "persistent" words
	Store []dictionary.Word
}

InMememoryRepository holds the methods for managing words

func NewInMememoryRepository

func NewInMememoryRepository() *InMememoryRepository

NewInMememoryRepository returns a new in-memory repository

func (*InMememoryRepository) CreateWord

func (r *InMememoryRepository) CreateWord(ctx context.Context, word string) (*dictionary.Word, error)

CreateWord adds word to the repository

func (*InMememoryRepository) DeleteWordById

func (r *InMememoryRepository) DeleteWordById(ctx context.Context, id string) error

DeleteWordById removes a word in the repository that matches the has the passed id

func (*InMememoryRepository) GetWordById

func (r *InMememoryRepository) GetWordById(ctx context.Context, id string) (*dictionary.Word, error)

GetWordById returns a word in the repository that matches the passed id

func (*InMememoryRepository) GetWordByName

func (r *InMememoryRepository) GetWordByName(ctx context.Context, name string) (*dictionary.Word, error)

GetWordById returns a word in the repository that matches the has the passed name

func (*InMememoryRepository) GetWords

func (r *InMememoryRepository) GetWords(ctx context.Context) ([]dictionary.Word, error)

GetWords returns all the words in the repository

Jump to

Keyboard shortcuts

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