Documentation
¶
Index ¶
- func MountFilesController(service *goa.Service, ctrl FilesController)
- func MountUserController(service *goa.Service, ctrl UserController)
- type CreateUserContext
- type CreateUserPayload
- type FilesController
- type GetUserContext
- type ListUserContext
- type User
- type UserCollection
- type UserController
- type UserCreatePayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MountFilesController ¶
func MountFilesController(service *goa.Service, ctrl FilesController)
MountFilesController "mounts" a Files resource controller on the given service.
func MountUserController ¶
func MountUserController(service *goa.Service, ctrl UserController)
MountUserController "mounts" a User resource controller on the given service.
Types ¶
type CreateUserContext ¶
type CreateUserContext struct {
context.Context
*goa.ResponseData
*goa.RequestData
Payload *CreateUserPayload
}
CreateUserContext provides the user create action context.
func NewCreateUserContext ¶
func NewCreateUserContext(ctx context.Context, r *http.Request, service *goa.Service) (*CreateUserContext, error)
NewCreateUserContext parses the incoming request URL and body, performs validations and creates the context used by the user controller create action.
func (*CreateUserContext) InternalServerError ¶
func (ctx *CreateUserContext) InternalServerError() error
InternalServerError sends a HTTP response with status code 500.
func (*CreateUserContext) OK ¶
func (ctx *CreateUserContext) OK(resp []byte) error
OK sends a HTTP response with status code 200.
type CreateUserPayload ¶
type CreateUserPayload struct {
// age
Age *int `form:"age,omitempty" json:"age,omitempty" xml:"age,omitempty"`
// email
Email *string `form:"email,omitempty" json:"email,omitempty" xml:"email,omitempty"`
// name
Name string `form:"name" json:"name" xml:"name"`
// sex
Sex *string `form:"sex,omitempty" json:"sex,omitempty" xml:"sex,omitempty"`
}
CreateUserPayload is the user create action payload.
func (*CreateUserPayload) Validate ¶
func (payload *CreateUserPayload) Validate() (err error)
Validate runs the validation rules defined in the design.
type FilesController ¶
type FilesController interface {
goa.Muxer
goa.FileServer
}
FilesController is the controller interface for the Files actions.
type GetUserContext ¶
type GetUserContext struct {
context.Context
*goa.ResponseData
*goa.RequestData
UserID int
}
GetUserContext provides the user get action context.
func NewGetUserContext ¶
func NewGetUserContext(ctx context.Context, r *http.Request, service *goa.Service) (*GetUserContext, error)
NewGetUserContext parses the incoming request URL and body, performs validations and creates the context used by the user controller get action.
func (*GetUserContext) InternalServerError ¶
func (ctx *GetUserContext) InternalServerError() error
InternalServerError sends a HTTP response with status code 500.
func (*GetUserContext) OK ¶
func (ctx *GetUserContext) OK(r *User) error
OK sends a HTTP response with status code 200.
func (*GetUserContext) Unauthorized ¶
func (ctx *GetUserContext) Unauthorized() error
Unauthorized sends a HTTP response with status code 401.
type ListUserContext ¶
type ListUserContext struct {
context.Context
*goa.ResponseData
*goa.RequestData
}
ListUserContext provides the user list action context.
func NewListUserContext ¶
func NewListUserContext(ctx context.Context, r *http.Request, service *goa.Service) (*ListUserContext, error)
NewListUserContext parses the incoming request URL and body, performs validations and creates the context used by the user controller list action.
func (*ListUserContext) InternalServerError ¶
func (ctx *ListUserContext) InternalServerError() error
InternalServerError sends a HTTP response with status code 500.
func (*ListUserContext) OK ¶
func (ctx *ListUserContext) OK(r UserCollection) error
OK sends a HTTP response with status code 200.
func (*ListUserContext) Unauthorized ¶
func (ctx *ListUserContext) Unauthorized() error
Unauthorized sends a HTTP response with status code 401.
type User ¶
type User struct {
// age
Age *int `form:"age,omitempty" json:"age,omitempty" xml:"age,omitempty"`
// email
Email *string `form:"email,omitempty" json:"email,omitempty" xml:"email,omitempty"`
// name
Name string `form:"name" json:"name" xml:"name"`
// sex
Sex *string `form:"sex,omitempty" json:"sex,omitempty" xml:"sex,omitempty"`
}
User media type (default view)
Identifier: application/vnd.user+json; view=default
type UserCollection ¶
type UserCollection []*User
UserCollection is the media type for an array of User (default view)
Identifier: application/vnd.user+json; type=collection; view=default
func (UserCollection) Validate ¶
func (mt UserCollection) Validate() (err error)
Validate validates the UserCollection media type instance.
type UserController ¶
type UserController interface {
goa.Muxer
Create(*CreateUserContext) error
Get(*GetUserContext) error
List(*ListUserContext) error
}
UserController is the controller interface for the User actions.
type UserCreatePayload ¶
type UserCreatePayload struct {
// age
Age *int `form:"age,omitempty" json:"age,omitempty" xml:"age,omitempty"`
// email
Email *string `form:"email,omitempty" json:"email,omitempty" xml:"email,omitempty"`
// name
Name string `form:"name" json:"name" xml:"name"`
// sex
Sex *string `form:"sex,omitempty" json:"sex,omitempty" xml:"sex,omitempty"`
}
UserCreatePayload user type.
func (*UserCreatePayload) Validate ¶
func (ut *UserCreatePayload) Validate() (err error)
Validate validates the UserCreatePayload type instance.