adapters

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCachedTracker

func NewCachedTracker(tracker usecases.Tracker, cache Cache) (usecases.Tracker, error)

Types

type AnilistMapper

type AnilistMapper struct {
	Source MetadataSource[Metadata]
	Store  AnilistStore
}

func (*AnilistMapper) Close

func (mapper *AnilistMapper) Close() error

func (*AnilistMapper) MapID

func (mapper *AnilistMapper) MapID(ctx context.Context, anilistId string) (string, error)

func (*AnilistMapper) MapIDs

func (mapper *AnilistMapper) MapIDs(ctx context.Context, anilistIds []string) ([]string, error)

func (*AnilistMapper) Refresh

func (mapper *AnilistMapper) Refresh(ctx context.Context) error

type AnilistStore

type AnilistStore interface {
	Store

	MappingByAnilistID(ctx context.Context, anilistId string) (*entities.Media, error)
	MappingByAnilistIDBulk(ctx context.Context, anilistIds []string) ([]*entities.Media, error)
}

type Cache

type Cache interface {
	io.Closer

	GetString(ctx context.Context, key string) (string, error)
	SetString(ctx context.Context, key, value string) error
}

type Getter

type Getter interface {
	Get(string) (*http.Response, error)
}

type JSONLocalPath

type JSONLocalPath[F Metadata] string

func (JSONLocalPath[F]) Fetch

func (source JSONLocalPath[F]) Fetch(ctx context.Context) ([]Metadata, error)

type JSONSourceURL

type JSONSourceURL[F Metadata] string

func (JSONSourceURL[F]) Fetch

func (source JSONSourceURL[F]) Fetch(ctx context.Context, client Getter) ([]Metadata, error)

type Metadata

type Metadata interface {
	GetAnilistID() string
	GetTvdbID() string
}

type MetadataSource

type MetadataSource[T Metadata] interface {
	Fetch(ctx context.Context, client Getter) ([]T, error)
}

type Store

type Store interface {
	io.Closer

	PutMedia(ctx context.Context, media *entities.Media) error
	PutMediaBulk(ctx context.Context, medias []*entities.Media) error
}

Jump to

Keyboard shortcuts

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