Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrPlanetNotFound = errors.New("planet not found")
Functions ¶
This section is empty.
Types ¶
type Planet ¶
type Planet struct { Name string `json:"name" valid:"length(2|128)"` Climate string `json:"climate" valid:"length(2|128)"` Terrain string `json:"terrain" valid:"length(2|128)"` Appearances int `json:"appearances" valid:"optional"` }
Planet defines the properties of a planet to be added
type PlanetsClient ¶
PlanetsClient provides an interface to fetch extra planets info from a third-party API
type Repository ¶
type Repository interface { // AddPlanet saves a given planet to the repository. AddPlanet(context.Context, Planet) (string, error) }
Repository provides access to planet repository.
type Service ¶
type Service interface { // AddPlanet invokes the operations needed to save a planet AddPlanet(context.Context, Planet) (string, error) }
Service provides planet adding operations.
func NewService ¶
func NewService(r Repository, p PlanetsClient) Service
NewService creates an adding service with the necessary dependencies
type ValidationError ¶
ValidationError defines the type for a validation error
func NewValidationError ¶
func NewValidationError(err error) *ValidationError
func (ValidationError) Error ¶
func (e ValidationError) Error() string
Click to show internal directories.
Click to hide internal directories.