service

package
v0.0.0-...-ea7ac5c Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidDate = errors.New("provided date cannot exceed the current date")

Functions

This section is empty.

Types

type APODClient

type APODClient interface {
	GetPictureOfTheDay(ctx context.Context, date string) (apod.Picture, error)
}

type Picture

type Picture struct {
	// contains filtered or unexported fields
}

Proxy contains service logic for retrieveing pictures from the APOD API or database.

func NewPicture

func NewPicture(client APODClient, repository PictureRepository) *Picture

NewPicture is a constructor for Picture.

func (Picture) GetByDate

func (a Picture) GetByDate(ctx context.Context, date string) (model.Picture, error)

GetByDate retrieves picture from the APOD API or database by a specific date.

func (Picture) List

func (a Picture) List(ctx context.Context) ([]model.Picture, error)

List retrieves all stored pictures from a database.

type PictureRepository

type PictureRepository interface {
	Create(ctx context.Context, picture model.Picture) error
	GetByDate(ctx context.Context, dateTime time.Time) (model.Picture, error)
	List(ctx context.Context) ([]model.Picture, error)
}

Jump to

Keyboard shortcuts

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