Documentation ¶
Index ¶
- Variables
- type BadgerRepository
- func (br *BadgerRepository) AddWordInto(ctx context.Context, word Word) error
- func (br *BadgerRepository) GetWordByID(ctx context.Context, id string) (Word, error)
- func (br *BadgerRepository) GetWordByW(ctx context.Context, word string) (Word, error)
- func (br *BadgerRepository) Words(ctx context.Context) ([]Word, error)
- type Repository
- type Word
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDublicateWord = errors.New("Repository has found the same word")
ErrDublicateWord erorr when word is not found
View Source
var ErrRepository = errors.New("Repository cannot do that you want")
ErrRepository is the default erorr in repo
View Source
var ErrWordNotFound = errors.New("Repository cannot has found one")
ErrWordNotFound erorr when word is not found
Functions ¶
This section is empty.
Types ¶
type BadgerRepository ¶
BadgerRepository is implementation Repository by Badger
func (*BadgerRepository) AddWordInto ¶
func (br *BadgerRepository) AddWordInto(ctx context.Context, word Word) error
AddWordInto adds word into badger if this one doesn't exiest there
func (*BadgerRepository) GetWordByID ¶
GetWordByID gets word from badger by ID
func (*BadgerRepository) GetWordByW ¶
GetWordByW gets word from badger by W
type Repository ¶
type Repository interface { Words(ctx context.Context) ([]Word, error) AddWordInto(ctx context.Context, word Word) error GetWordByID(ctx context.Context, id string) (Word, error) GetWordByW(ctx context.Context, w string) (Word, error) }
func NewBadgerRepository ¶
func NewBadgerRepository(dir string, logger log.Logger) Repository
NewBadgerRepository creates and returns new repository
Click to show internal directories.
Click to hide internal directories.