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
Click to show internal directories.
Click to hide internal directories.