Documentation ¶
Index ¶
- Constants
- Variables
- func GetPage[T any](data []T, page Page) []T
- func TimeTracker(start time.Time, name string)
- type Card
- type CardRepository
- type CardService
- type Cards
- type Collectable
- type CollectionRepository
- type CollectionService
- type Collector
- type DetectRepository
- type DetectService
- type Filter
- type ID
- type IDs
- type Image
- type Match
- type Matches
- type Page
- type PagedResult
- type Score
- type Scores
- type Set
Constants ¶
View Source
const DefaultLang = "eng"
Variables ¶
View Source
var ErrCardNotFound = errors.New("card not found")
View Source
var ErrInvalidID = errors.New("invalid id")
View Source
var (
ErrMatchNotFound = errors.New("no match found")
)
Functions ¶
func TimeTracker ¶
Types ¶
type CardRepository ¶
type CardService ¶
type CardService interface {
Search(ctx context.Context, name string, collector Collector, page Page) (Cards, error)
}
func NewCardService ¶
func NewCardService(repo CardRepository) CardService
type Collectable ¶
Collectable a collectable item.
func NewCollectable ¶
func NewCollectable(id int, amount int) (Collectable, error)
type CollectionRepository ¶
type CollectionRepository interface { // Find returns the cards for the requested page matching the given criteria. Find(ctx context.Context, filter Filter, page Page) (Cards, error) // Exist returns true if a card with the given ID exist, false otherwise. Exist(ctx context.Context, id ID) (bool, error) // Collect adds or removes an card from a collection. Collect(ctx context.Context, item Collectable, c Collector) error // Remove removes the item from the collection. Remove(ctx context.Context, item Collectable, c Collector) error }
type CollectionService ¶
type CollectionService interface { Search(ctx context.Context, name string, c Collector, p Page) (Cards, error) Collect(ctx context.Context, item Collectable, c Collector) (Collectable, error) }
func NewCollectionService ¶
func NewCollectionService(cRepo CollectionRepository) CollectionService
type Collector ¶
type Collector struct {
ID string
}
Collector user who interacts with his collection.
func NewCollector ¶
type DetectRepository ¶
type DetectService ¶
type DetectService interface {
Detect(ctx context.Context, collector Collector, in io.Reader) (Matches, error)
}
func NewDetectService ¶
func NewDetectService(cRepo CardRepository, dRepo DetectRepository, detector image.Detector, hasher image.Hasher) DetectService
type Filter ¶
func (Filter) WithCollector ¶
func (Filter) WithLanguage ¶
func (Filter) WithOnlyCollected ¶
type Page ¶
type Page struct {
// contains filtered or unexported fields
}
func DefaultPage ¶
func DefaultPage() Page
type PagedResult ¶
func NewEmptyResult ¶
func NewEmptyResult[T any](page Page) PagedResult[T]
func NewPagedResult ¶
func NewPagedResult[T any](data []T, page Page) PagedResult[T]
Click to show internal directories.
Click to hide internal directories.