Documentation
¶
Index ¶
- func AccountHref(accountID interface{}) string
- func BottleHref(accountID, bottleID interface{}) string
- func MountAccountController(service goa.Service, ctrl AccountController)
- func MountBottleController(service goa.Service, ctrl BottleController)
- type Account
- type AccountController
- type AccountViewEnum
- type Bottle
- type BottleCollection
- type BottleCollectionViewEnum
- type BottleController
- type BottlePayload
- type BottleViewEnum
- type CreateAccountContext
- type CreateAccountPayload
- type CreateBottleContext
- type CreateBottlePayload
- type DeleteAccountContext
- type DeleteBottleContext
- type ListBottleContext
- type RateBottleContext
- type RateBottlePayload
- type ShowAccountContext
- type ShowBottleContext
- type UpdateAccountContext
- type UpdateAccountPayload
- type UpdateBottleContext
- type UpdateBottlePayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccountHref ¶
func AccountHref(accountID interface{}) string
AccountHref returns the resource href.
func BottleHref ¶
func BottleHref(accountID, bottleID interface{}) string
BottleHref returns the resource href.
func MountAccountController ¶
func MountAccountController(service goa.Service, ctrl AccountController)
MountAccountController "mounts" a Account resource controller on the given service.
func MountBottleController ¶
func MountBottleController(service goa.Service, ctrl BottleController)
MountBottleController "mounts" a Bottle resource controller on the given service.
Types ¶
type Account ¶
type Account struct {
// Date of creation
CreatedAt string
// Email of account owner
CreatedBy string
// API href of account
Href string
// ID of account
ID int
// Name of account
Name string
}
A tenant account Identifier: application/vnd.goa.example.account+json
func LoadAccount ¶
LoadAccount loads raw data into an instance of Account running all the validations. Raw data is defined by data that the JSON unmarshaler would create when unmarshaling into a variable of type interface{}. See https://golang.org/pkg/encoding/json/#Unmarshal for the complete list of supported data types.
type AccountController ¶
type AccountController interface {
goa.Controller
Create(*CreateAccountContext) error
Delete(*DeleteAccountContext) error
Show(*ShowAccountContext) error
Update(*UpdateAccountContext) error
}
AccountController is the controller interface for the Account actions.
type AccountViewEnum ¶
type AccountViewEnum string
object views
const ( // Account default view AccountDefaultView AccountViewEnum = "default" // Account link view AccountLinkView AccountViewEnum = "link" )
type Bottle ¶
type Bottle struct {
// Account that owns bottle
Account *Account
Color string
Country string
// Date of creation
CreatedAt string
// API href of bottle
Href string
// ID of bottle
ID int
Name string
// Rating of bottle between 1 and 5
Rating int
Region string
Review string
Sweetness int
// Date of last update
UpdatedAt string
Varietal string
Vineyard string
Vintage int
}
A bottle of wine Identifier: application/vnd.goa.example.bottle+json
func LoadBottle ¶
LoadBottle loads raw data into an instance of Bottle running all the validations. Raw data is defined by data that the JSON unmarshaler would create when unmarshaling into a variable of type interface{}. See https://golang.org/pkg/encoding/json/#Unmarshal for the complete list of supported data types.
type BottleCollection ¶
type BottleCollection []*Bottle
BottleCollection media type Identifier: application/vnd.goa.example.bottle+json; type=collection
func LoadBottleCollection ¶
func LoadBottleCollection(raw interface{}) (BottleCollection, error)
LoadBottleCollection loads raw data into an instance of BottleCollection running all the validations. Raw data is defined by data that the JSON unmarshaler would create when unmarshaling into a variable of type interface{}. See https://golang.org/pkg/encoding/json/#Unmarshal for the complete list of supported data types.
func (BottleCollection) Dump ¶
func (mt BottleCollection) Dump(view BottleCollectionViewEnum) ([]map[string]interface{}, error)
Dump produces raw data from an instance of BottleCollection running all the validations. See LoadBottleCollection for the definition of raw data.
func (BottleCollection) Validate ¶
func (mt BottleCollection) Validate() (err error)
Validate validates the media type instance.
type BottleCollectionViewEnum ¶
type BottleCollectionViewEnum string
array views
const ( // BottleCollection default view BottleCollectionDefaultView BottleCollectionViewEnum = "default" // BottleCollection tiny view BottleCollectionTinyView BottleCollectionViewEnum = "tiny" )
type BottleController ¶
type BottleController interface {
goa.Controller
Create(*CreateBottleContext) error
Delete(*DeleteBottleContext) error
List(*ListBottleContext) error
Rate(*RateBottleContext) error
Show(*ShowBottleContext) error
Update(*UpdateBottleContext) error
}
BottleController is the controller interface for the Bottle actions.
type BottlePayload ¶
type BottlePayload struct {
Color string
Country string
Name string
Region string
Review string
Sweetness int
Varietal string
Vineyard string
Vintage int
}
BottlePayload type
type BottleViewEnum ¶
type BottleViewEnum string
object views
const ( // Bottle default view BottleDefaultView BottleViewEnum = "default" // Bottle full view BottleFullView BottleViewEnum = "full" // Bottle tiny view BottleTinyView BottleViewEnum = "tiny" )
type CreateAccountContext ¶
type CreateAccountContext struct {
*goa.Context
Payload *CreateAccountPayload
}
CreateAccountContext provides the account create action context.
func NewCreateAccountContext ¶
func NewCreateAccountContext(c *goa.Context) (*CreateAccountContext, error)
NewCreateAccountContext parses the incoming request URL and body, performs validations and creates the context used by the account controller create action.
func (*CreateAccountContext) Created ¶
func (ctx *CreateAccountContext) Created() error
Created sends a HTTP response with status code 201.
type CreateAccountPayload ¶
type CreateAccountPayload struct {
// Name of account
Name string
}
CreateAccountPayload is the account create action payload.
func NewCreateAccountPayload ¶
func NewCreateAccountPayload(raw interface{}) (*CreateAccountPayload, error)
NewCreateAccountPayload instantiates a CreateAccountPayload from a raw request body. It validates each field and returns an error if any validation fails.
type CreateBottleContext ¶
type CreateBottleContext struct {
*goa.Context
AccountID int
Payload *CreateBottlePayload
}
CreateBottleContext provides the bottle create action context.
func NewCreateBottleContext ¶
func NewCreateBottleContext(c *goa.Context) (*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) Created ¶
func (ctx *CreateBottleContext) Created() error
Created sends a HTTP response with status code 201.
type CreateBottlePayload ¶
type CreateBottlePayload struct {
Color string
Country string
Name string
Region string
Review string
Sweetness int
Varietal string
Vineyard string
Vintage int
}
CreateBottlePayload is the bottle create action payload.
func NewCreateBottlePayload ¶
func NewCreateBottlePayload(raw interface{}) (*CreateBottlePayload, error)
NewCreateBottlePayload instantiates a CreateBottlePayload from a raw request body. It validates each field and returns an error if any validation fails.
type DeleteAccountContext ¶
DeleteAccountContext provides the account delete action context.
func NewDeleteAccountContext ¶
func NewDeleteAccountContext(c *goa.Context) (*DeleteAccountContext, error)
NewDeleteAccountContext parses the incoming request URL and body, performs validations and creates the context used by the account controller delete action.
func (*DeleteAccountContext) NoContent ¶
func (ctx *DeleteAccountContext) NoContent() error
NoContent sends a HTTP response with status code 204.
func (*DeleteAccountContext) NotFound ¶
func (ctx *DeleteAccountContext) NotFound() error
NotFound sends a HTTP response with status code 404.
type DeleteBottleContext ¶
DeleteBottleContext provides the bottle delete action context.
func NewDeleteBottleContext ¶
func NewDeleteBottleContext(c *goa.Context) (*DeleteBottleContext, error)
NewDeleteBottleContext parses the incoming request URL and body, performs validations and creates the context used by the bottle controller delete action.
func (*DeleteBottleContext) NoContent ¶
func (ctx *DeleteBottleContext) NoContent() error
NoContent sends a HTTP response with status code 204.
func (*DeleteBottleContext) NotFound ¶
func (ctx *DeleteBottleContext) NotFound() error
NotFound sends a HTTP response with status code 404.
type ListBottleContext ¶
ListBottleContext provides the bottle list action context.
func NewListBottleContext ¶
func NewListBottleContext(c *goa.Context) (*ListBottleContext, error)
NewListBottleContext parses the incoming request URL and body, performs validations and creates the context used by the bottle controller list action.
func (*ListBottleContext) OK ¶
func (ctx *ListBottleContext) OK(resp BottleCollection, view BottleCollectionViewEnum) error
OK sends a HTTP response with status code 200.
type RateBottleContext ¶
type RateBottleContext struct {
*goa.Context
AccountID int
BottleID int
Payload *RateBottlePayload
}
RateBottleContext provides the bottle rate action context.
func NewRateBottleContext ¶
func NewRateBottleContext(c *goa.Context) (*RateBottleContext, error)
NewRateBottleContext parses the incoming request URL and body, performs validations and creates the context used by the bottle controller rate action.
func (*RateBottleContext) NoContent ¶
func (ctx *RateBottleContext) NoContent() error
NoContent sends a HTTP response with status code 204.
func (*RateBottleContext) NotFound ¶
func (ctx *RateBottleContext) NotFound() error
NotFound sends a HTTP response with status code 404.
type RateBottlePayload ¶
type RateBottlePayload struct {
// Rating of bottle between 1 and 5
Rating int
}
RateBottlePayload is the bottle rate action payload.
func NewRateBottlePayload ¶
func NewRateBottlePayload(raw interface{}) (*RateBottlePayload, error)
NewRateBottlePayload instantiates a RateBottlePayload from a raw request body. It validates each field and returns an error if any validation fails.
type ShowAccountContext ¶
ShowAccountContext provides the account show action context.
func NewShowAccountContext ¶
func NewShowAccountContext(c *goa.Context) (*ShowAccountContext, error)
NewShowAccountContext parses the incoming request URL and body, performs validations and creates the context used by the account controller show action.
func (*ShowAccountContext) NotFound ¶
func (ctx *ShowAccountContext) NotFound() error
NotFound sends a HTTP response with status code 404.
func (*ShowAccountContext) OK ¶
func (ctx *ShowAccountContext) OK(resp *Account, view AccountViewEnum) error
OK sends a HTTP response with status code 200.
type ShowBottleContext ¶
ShowBottleContext provides the bottle show action context.
func NewShowBottleContext ¶
func NewShowBottleContext(c *goa.Context) (*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(resp *Bottle, view BottleViewEnum) error
OK sends a HTTP response with status code 200.
type UpdateAccountContext ¶
type UpdateAccountContext struct {
*goa.Context
AccountID int
Payload *UpdateAccountPayload
}
UpdateAccountContext provides the account update action context.
func NewUpdateAccountContext ¶
func NewUpdateAccountContext(c *goa.Context) (*UpdateAccountContext, error)
NewUpdateAccountContext parses the incoming request URL and body, performs validations and creates the context used by the account controller update action.
func (*UpdateAccountContext) NoContent ¶
func (ctx *UpdateAccountContext) NoContent() error
NoContent sends a HTTP response with status code 204.
func (*UpdateAccountContext) NotFound ¶
func (ctx *UpdateAccountContext) NotFound() error
NotFound sends a HTTP response with status code 404.
type UpdateAccountPayload ¶
type UpdateAccountPayload struct {
// Name of account
Name string
}
UpdateAccountPayload is the account update action payload.
func NewUpdateAccountPayload ¶
func NewUpdateAccountPayload(raw interface{}) (*UpdateAccountPayload, error)
NewUpdateAccountPayload instantiates a UpdateAccountPayload from a raw request body. It validates each field and returns an error if any validation fails.
type UpdateBottleContext ¶
type UpdateBottleContext struct {
*goa.Context
AccountID int
BottleID int
Payload *UpdateBottlePayload
}
UpdateBottleContext provides the bottle update action context.
func NewUpdateBottleContext ¶
func NewUpdateBottleContext(c *goa.Context) (*UpdateBottleContext, error)
NewUpdateBottleContext parses the incoming request URL and body, performs validations and creates the context used by the bottle controller update action.
func (*UpdateBottleContext) NoContent ¶
func (ctx *UpdateBottleContext) NoContent() error
NoContent sends a HTTP response with status code 204.
func (*UpdateBottleContext) NotFound ¶
func (ctx *UpdateBottleContext) NotFound() error
NotFound sends a HTTP response with status code 404.
type UpdateBottlePayload ¶
type UpdateBottlePayload struct {
Color string
Country string
Name string
Region string
Review string
Sweetness int
Varietal string
Vineyard string
Vintage int
}
UpdateBottlePayload is the bottle update action payload.
func NewUpdateBottlePayload ¶
func NewUpdateBottlePayload(raw interface{}) (*UpdateBottlePayload, error)
NewUpdateBottlePayload instantiates a UpdateBottlePayload from a raw request body. It validates each field and returns an error if any validation fails.