app

package
v0.0.0-...-3014a84 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Index

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 MarshalAccount

func MarshalAccount(source *Account, inErr error) (target map[string]interface{}, err error)

MarshalAccount validates and renders an instance of Account into a interface{} using view "default".

func MarshalAccountLink(source *Account, inErr error) (target map[string]interface{}, err error)

MarshalAccountLink validates and renders an instance of Account into a interface{} using view "link".

func MarshalBottle

func MarshalBottle(source *Bottle, inErr error) (target map[string]interface{}, err error)

MarshalBottle validates and renders an instance of Bottle into a interface{} using view "default".

func MarshalBottleCollection

func MarshalBottleCollection(source BottleCollection, inErr error) (target []map[string]interface{}, err error)

MarshalBottleCollection validates and renders an instance of BottleCollection into a interface{} using view "default".

func MarshalBottleCollectionTiny

func MarshalBottleCollectionTiny(source BottleCollection, inErr error) (target []map[string]interface{}, err error)

MarshalBottleCollectionTiny validates and renders an instance of BottleCollection into a interface{} using view "tiny".

func MarshalBottleFull

func MarshalBottleFull(source *Bottle, inErr error) (target map[string]interface{}, err error)

MarshalBottleFull validates and renders an instance of Bottle into a interface{} using view "full".

func MarshalBottlePayload

func MarshalBottlePayload(source *BottlePayload, inErr error) (target map[string]interface{}, err error)

MarshalBottlePayload validates and renders an instance of BottlePayload into a interface{}

func MarshalBottleTiny

func MarshalBottleTiny(source *Bottle, inErr error) (target map[string]interface{}, err error)

MarshalBottleTiny validates and renders an instance of Bottle into a interface{} using view "tiny".

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.account+json

func LoadAccount

func LoadAccount(raw interface{}) (res *Account, err error)

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.

func UnmarshalAccount

func UnmarshalAccount(source interface{}, inErr error) (target *Account, err error)

UnmarshalAccount unmarshals and validates a raw interface{} into an instance of Account

func (*Account) Dump

func (mt *Account) Dump(view AccountViewEnum) (res map[string]interface{}, err error)

Dump produces raw data from an instance of Account running all the validations. See LoadAccount for the definition of raw data.

func (*Account) Validate

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

Validate validates the media type instance.

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

Account 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.bottle+json

func LoadBottle

func LoadBottle(raw interface{}) (res *Bottle, err error)

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.

func UnmarshalBottle

func UnmarshalBottle(source interface{}, inErr error) (target *Bottle, err error)

UnmarshalBottle unmarshals and validates a raw interface{} into an instance of Bottle

func (*Bottle) Dump

func (mt *Bottle) Dump(view BottleViewEnum) (res map[string]interface{}, err error)

Dump produces raw data from an instance of Bottle running all the validations. See LoadBottle for the definition of raw data.

func (*Bottle) Validate

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

Validate validates the media type instance.

type BottleCollection

type BottleCollection []*Bottle

BottleCollection media type Identifier: application/vnd.bottle+json; type=collection

func LoadBottleCollection

func LoadBottleCollection(raw interface{}) (res BottleCollection, err 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 UnmarshalBottleCollection

func UnmarshalBottleCollection(source interface{}, inErr error) (target BottleCollection, err error)

UnmarshalBottleCollection unmarshals and validates a raw interface{} into an instance of BottleCollection

func (BottleCollection) Dump

func (mt BottleCollection) Dump(view BottleCollectionViewEnum) (res []map[string]interface{}, err 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

BottleCollection views

const (
	// BottleCollection default view
	BottleCollectionDefaultView BottleCollectionViewEnum = "default"
	// BottleCollection tiny view
	BottleCollectionTinyView BottleCollectionViewEnum = "tiny"
)

type BottleController

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

func UnmarshalBottlePayload

func UnmarshalBottlePayload(source interface{}, inErr error) (target *BottlePayload, err error)

UnmarshalBottlePayload unmarshals and validates a raw interface{} into an instance of BottlePayload

type BottleViewEnum

type BottleViewEnum string

Bottle 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{}) (p *CreateAccountPayload, err error)

NewCreateAccountPayload instantiates a CreateAccountPayload from a raw request body. It validates each field and returns an error if any validation fails.

func UnmarshalCreateAccountPayload

func UnmarshalCreateAccountPayload(source interface{}, inErr error) (target *CreateAccountPayload, err error)

UnmarshalCreateAccountPayload unmarshals and validates a raw interface{} into an instance of CreateAccountPayload

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{}) (p *CreateBottlePayload, err error)

NewCreateBottlePayload instantiates a CreateBottlePayload from a raw request body. It validates each field and returns an error if any validation fails.

func UnmarshalCreateBottlePayload

func UnmarshalCreateBottlePayload(source interface{}, inErr error) (target *CreateBottlePayload, err error)

UnmarshalCreateBottlePayload unmarshals and validates a raw interface{} into an instance of CreateBottlePayload

type DeleteAccountContext

type DeleteAccountContext struct {
	*goa.Context
	AccountID int
}

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

type DeleteBottleContext struct {
	*goa.Context
	AccountID int
	BottleID  int
}

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

type ListBottleContext struct {
	*goa.Context
	AccountID int
	Years     []int

	HasYears bool
}

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) NotFound

func (ctx *ListBottleContext) NotFound() error

NotFound sends a HTTP response with status code 404.

func (*ListBottleContext) OK

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{}) (p *RateBottlePayload, err error)

NewRateBottlePayload instantiates a RateBottlePayload from a raw request body. It validates each field and returns an error if any validation fails.

func UnmarshalRateBottlePayload

func UnmarshalRateBottlePayload(source interface{}, inErr error) (target *RateBottlePayload, err error)

UnmarshalRateBottlePayload unmarshals and validates a raw interface{} into an instance of RateBottlePayload

type ShowAccountContext

type ShowAccountContext struct {
	*goa.Context
	AccountID int
}

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

type ShowBottleContext struct {
	*goa.Context
	AccountID int
	BottleID  int
}

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{}) (p *UpdateAccountPayload, err error)

NewUpdateAccountPayload instantiates a UpdateAccountPayload from a raw request body. It validates each field and returns an error if any validation fails.

func UnmarshalUpdateAccountPayload

func UnmarshalUpdateAccountPayload(source interface{}, inErr error) (target *UpdateAccountPayload, err error)

UnmarshalUpdateAccountPayload unmarshals and validates a raw interface{} into an instance of UpdateAccountPayload

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{}) (p *UpdateBottlePayload, err error)

NewUpdateBottlePayload instantiates a UpdateBottlePayload from a raw request body. It validates each field and returns an error if any validation fails.

func UnmarshalUpdateBottlePayload

func UnmarshalUpdateBottlePayload(source interface{}, inErr error) (target *UpdateBottlePayload, err error)

UnmarshalUpdateBottlePayload unmarshals and validates a raw interface{} into an instance of UpdateBottlePayload

Jump to

Keyboard shortcuts

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