Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MountHeroController ¶
func MountHeroController(service *goa.Service, ctrl HeroController)
MountHeroController "mounts" a Hero resource controller on the given service.
Types ¶
type CreateHeroContext ¶
type CreateHeroContext struct { context.Context *goa.ResponseData *goa.RequestData Payload *CreateHeroPayload }
CreateHeroContext provides the hero create action context.
func NewCreateHeroContext ¶
func NewCreateHeroContext(ctx context.Context, r *http.Request, service *goa.Service) (*CreateHeroContext, error)
NewCreateHeroContext parses the incoming request URL and body, performs validations and creates the context used by the hero controller create action.
func (*CreateHeroContext) BadRequest ¶
func (ctx *CreateHeroContext) BadRequest(r error) error
BadRequest sends a HTTP response with status code 400.
func (*CreateHeroContext) Created ¶
func (ctx *CreateHeroContext) Created() error
Created sends a HTTP response with status code 201.
type CreateHeroPayload ¶
type CreateHeroPayload struct {
Name string `form:"name" json:"name" xml:"name"`
}
CreateHeroPayload is the hero create action payload.
func (*CreateHeroPayload) Validate ¶
func (payload *CreateHeroPayload) Validate() (err error)
Validate runs the validation rules defined in the design.
type Hero ¶
type Hero struct { // Unique heroe ID ID int `form:"id" json:"id" xml:"id"` // Name of hero Name string `form:"name" json:"name" xml:"name"` }
A comic hero (default view)
Identifier: application/vnd.hero+json; view=default
type HeroCollection ¶
type HeroCollection []*Hero
HeroCollection is the media type for an array of Hero (default view)
Identifier: application/vnd.hero+json; type=collection; view=default
func (HeroCollection) Validate ¶
func (mt HeroCollection) Validate() (err error)
Validate validates the HeroCollection media type instance.
type HeroController ¶
type HeroController interface { goa.Muxer Create(*CreateHeroContext) error List(*ListHeroContext) error Show(*ShowHeroContext) error }
HeroController is the controller interface for the Hero actions.
type ListHeroContext ¶
type ListHeroContext struct { context.Context *goa.ResponseData *goa.RequestData }
ListHeroContext provides the hero list action context.
func NewListHeroContext ¶
func NewListHeroContext(ctx context.Context, r *http.Request, service *goa.Service) (*ListHeroContext, error)
NewListHeroContext parses the incoming request URL and body, performs validations and creates the context used by the hero controller list action.
func (*ListHeroContext) OK ¶
func (ctx *ListHeroContext) OK(r HeroCollection) error
OK sends a HTTP response with status code 200.
type ShowHeroContext ¶
type ShowHeroContext struct { context.Context *goa.ResponseData *goa.RequestData HeroID int }
ShowHeroContext provides the hero show action context.
func NewShowHeroContext ¶
func NewShowHeroContext(ctx context.Context, r *http.Request, service *goa.Service) (*ShowHeroContext, error)
NewShowHeroContext parses the incoming request URL and body, performs validations and creates the context used by the hero controller show action.
func (*ShowHeroContext) NotFound ¶
func (ctx *ShowHeroContext) NotFound() error
NotFound sends a HTTP response with status code 404.
func (*ShowHeroContext) OK ¶
func (ctx *ShowHeroContext) OK(r *Hero) error
OK sends a HTTP response with status code 200.