listing

package
v0.0.0-...-b7fba14 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPlanetNotFound error = errors.New("planet not found")
)

Functions

This section is empty.

Types

type Planet

type Planet struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Climate     string `json:"climate"`
	Terrain     string `json:"terrain"`
	Appearances int    `json:"appearances"`
}

Planet defines the storage form of a planet

type Repository

type Repository interface {
	// GetPlanet returns the planet with given ID.
	GetPlanet(context.Context, string) (Planet, error)
	// GetPlanets returns all planets saved in storage.
	GetPlanets(context.Context, int64, int64) ([]Planet, int64)
}

Repository provides access to the planet storage.

type Service

type Service interface {
	GetPlanet(context.Context, string) (Planet, error)
	GetPlanets(ctx context.Context, limit int64, offset int64) ([]Planet, int64)
}

Service provides planet listing operations.

func NewService

func NewService(r Repository) Service

NewService creates a listing service with the necessary dependencies

Jump to

Keyboard shortcuts

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