app

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2018 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BottleHref

func BottleHref(id interface{}) string

BottleHref returns the resource href.

func MountBottleController

func MountBottleController(service *goa.Service, ctrl BottleController)

MountBottleController "mounts" a Bottle resource controller on the given service.

func MountSpecController

func MountSpecController(service *goa.Service, ctrl SpecController)

MountSpecController "mounts" a Spec resource controller on the given service.

Types

type Bottle

type Bottle struct {
	// Unique bottle ID
	ID string `form:"id" json:"id" yaml:"id" xml:"id"`
	// Name of bottle
	Name string `form:"name" json:"name" yaml:"name" xml:"name"`
	// Rating of bottle
	Rating int `form:"rating" json:"rating" yaml:"rating" xml:"rating"`
	// Vintage of bottle
	Vintage int `form:"vintage" json:"vintage" yaml:"vintage" xml:"vintage"`
}

bottle media type (default view)

Identifier: application/vnd.gophercon.goa.bottle; view=default

func (*Bottle) Validate

func (mt *Bottle) Validate() (err error)

Validate validates the Bottle media type instance.

type BottleController

type BottleController interface {
	goa.Muxer
	Create(*CreateBottleContext) error
	Show(*ShowBottleContext) error
}

BottleController is the controller interface for the Bottle actions.

type BottlePayload

type BottlePayload struct {
	// Unique bottle ID
	ID *string `form:"id,omitempty" json:"id,omitempty" yaml:"id,omitempty" xml:"id,omitempty"`
	// Name of bottle
	Name string `form:"name" json:"name" yaml:"name" xml:"name"`
	// Rating of bottle
	Rating int `form:"rating" json:"rating" yaml:"rating" xml:"rating"`
	// Vintage of bottle
	Vintage int `form:"vintage" json:"vintage" yaml:"vintage" xml:"vintage"`
}

BottlePayload is the type used to create bottles

func (*BottlePayload) Validate

func (ut *BottlePayload) Validate() (err error)

Validate validates the BottlePayload type instance.

type CreateBottleContext

type CreateBottleContext struct {
	context.Context
	*goa.ResponseData
	*goa.RequestData
	Payload *BottlePayload
}

CreateBottleContext provides the bottle create action context.

func NewCreateBottleContext

func NewCreateBottleContext(ctx context.Context, r *http.Request, service *goa.Service) (*CreateBottleContext, error)

NewCreateBottleContext parses the incoming request URL and body, performs validations and creates the context used by the bottle controller create action.

func (*CreateBottleContext) BadRequest

func (ctx *CreateBottleContext) BadRequest(r error) error

BadRequest sends a HTTP response with status code 400.

func (*CreateBottleContext) Created

func (ctx *CreateBottleContext) Created(r *Bottle) error

Created sends a HTTP response with status code 201.

func (*CreateBottleContext) InternalServerError

func (ctx *CreateBottleContext) InternalServerError() error

InternalServerError sends a HTTP response with status code 500.

type ShowBottleContext

type ShowBottleContext struct {
	context.Context
	*goa.ResponseData
	*goa.RequestData
	ID string
}

ShowBottleContext provides the bottle show action context.

func NewShowBottleContext

func NewShowBottleContext(ctx context.Context, r *http.Request, service *goa.Service) (*ShowBottleContext, error)

NewShowBottleContext parses the incoming request URL and body, performs validations and creates the context used by the bottle controller show action.

func (*ShowBottleContext) NotFound

func (ctx *ShowBottleContext) NotFound() error

NotFound sends a HTTP response with status code 404.

func (*ShowBottleContext) OK

func (ctx *ShowBottleContext) OK(r *Bottle) error

OK sends a HTTP response with status code 200.

type SpecController

type SpecController interface {
	goa.Muxer
	goa.FileServer
}

SpecController is the controller interface for the Spec actions.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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