storage

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2022 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInternal = errors.New("internal storage error")

Functions

This section is empty.

Types

type CardRepo

type CardRepo interface {
	Repo[domain.Card]

	ListAllInDeck(ctx context.Context, deck domain.Deck) ([]domain.Card, error)

	FindAll(ctx context.Context, word, translation string) ([]domain.Card, error)
	FindAllInDeck(ctx context.Context, word, translation string, deck domain.Deck) ([]domain.Card, error)
	FindAllByWord(ctx context.Context, word string) ([]domain.Card, error)
	FindAllByWordInDeck(ctx context.Context, word string, deck domain.Deck) ([]domain.Card, error)

	DeleteAllInDeck(ctx context.Context, deck domain.Deck) error
}

type DeckRepo

type DeckRepo interface {
	Repo[domain.Deck]

	FindByName(ctx context.Context, name string) (*domain.Deck, error)
}

type Repo

type Repo[T any] interface {
	ListAll(ctx context.Context) ([]T, error)

	FindByID(ctx context.Context, id string) (*T, error)

	Save(ctx context.Context, item T) (*T, error)

	Delete(ctx context.Context, item T) error
}

type Storage

type Storage interface {
	GetCardRepo() CardRepo
	GetDeckRepo() DeckRepo
	Close() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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