Documentation ¶
Index ¶
- func ToAccountLink(account *AccountModel) *app.AccountLink
- func ToAccountMedia(account *AccountModel) *app.Account
- func ToBottleMedia(b *BottleModel) *app.Bottle
- func Watcher(accountID, bottleID int) websocket.Handler
- type AccountController
- type AccountModel
- type BottleController
- func (b *BottleController) Create(ctx *app.CreateBottleContext) error
- func (b *BottleController) Delete(ctx *app.DeleteBottleContext) error
- func (b *BottleController) List(ctx *app.ListBottleContext) error
- func (b *BottleController) Rate(ctx *app.RateBottleContext) error
- func (b *BottleController) Show(ctx *app.ShowBottleContext) error
- func (b *BottleController) Update(ctx *app.UpdateBottleContext) error
- func (b *BottleController) Watch(ctx *app.WatchBottleContext) error
- type BottleModel
- type DB
- func (db *DB) DeleteAccount(account *AccountModel)
- func (db *DB) DeleteBottle(bottle *BottleModel)
- func (db *DB) GetAccount(id int) *AccountModel
- func (db *DB) GetBottle(account, id int) *BottleModel
- func (db *DB) GetBottles(account int) ([]*BottleModel, error)
- func (db *DB) GetBottlesByYears(account int, years []int) ([]*BottleModel, error)
- func (db *DB) NewAccount() *AccountModel
- func (db *DB) NewBottle(account int) *BottleModel
- func (db *DB) SaveAccount(a *AccountModel)
- func (db *DB) SaveBottle(b *BottleModel)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToAccountLink ¶
func ToAccountLink(account *AccountModel) *app.AccountLink
ToAccountLink builds an account link from an account model.
func ToAccountMedia ¶
func ToAccountMedia(account *AccountModel) *app.Account
ToAccountMedia builds an account media type from an account model.
func ToBottleMedia ¶
func ToBottleMedia(b *BottleModel) *app.Bottle
ToBottleMedia converts a bottle model into a bottle media type
Types ¶
type AccountController ¶
type AccountController struct { *goa.Controller // contains filtered or unexported fields }
AccountController implements the account resource.
func NewAccount ¶
func NewAccount(service *goa.Service) *AccountController
NewAccount creates a account controller.
func (*AccountController) Create ¶
func (b *AccountController) Create(c *app.CreateAccountContext) error
Create records a new account.
func (*AccountController) Delete ¶
func (b *AccountController) Delete(c *app.DeleteAccountContext) error
Delete removes a account from the database.
func (*AccountController) Show ¶
func (b *AccountController) Show(c *app.ShowAccountContext) error
Show retrieves the account with the given id.
func (*AccountController) Update ¶
func (b *AccountController) Update(c *app.UpdateAccountContext) error
Update updates a account field(s).
type AccountModel ¶
AccountModel is the database "model" for accounts
type BottleController ¶
type BottleController struct { *goa.Controller // contains filtered or unexported fields }
BottleController implements the bottle resource.
func NewBottle ¶
func NewBottle(service *goa.Service) *BottleController
NewBottle creates a bottle controller.
func (*BottleController) Create ¶
func (b *BottleController) Create(ctx *app.CreateBottleContext) error
Create records a new bottle.
func (*BottleController) Delete ¶
func (b *BottleController) Delete(ctx *app.DeleteBottleContext) error
Delete removes a bottle from the database.
func (*BottleController) List ¶
func (b *BottleController) List(ctx *app.ListBottleContext) error
List lists all the bottles in the account optionally filtering by year.
func (*BottleController) Rate ¶
func (b *BottleController) Rate(ctx *app.RateBottleContext) error
Rate rates a bottle.
func (*BottleController) Show ¶
func (b *BottleController) Show(ctx *app.ShowBottleContext) error
Show retrieves the bottle with the given id.
func (*BottleController) Update ¶
func (b *BottleController) Update(ctx *app.UpdateBottleContext) error
Update updates a bottle field(s).
func (*BottleController) Watch ¶
func (b *BottleController) Watch(ctx *app.WatchBottleContext) error
Watch watches the bottle with the given id.
type BottleModel ¶
type BottleModel struct { ID int Href string Account *AccountModel Name string Kind string Color string Country *string CreatedAt *string Rating *int Region *string Review *string Sweetness *int UpdatedAt *string Varietal string Vineyard string Vintage int }
BottleModel is the database "model" for bottles
type DB ¶
DB emulates a database driver using in-memory data structures.
func (*DB) DeleteAccount ¶
func (db *DB) DeleteAccount(account *AccountModel)
DeleteAccount deletes the account.
func (*DB) DeleteBottle ¶
func (db *DB) DeleteBottle(bottle *BottleModel)
DeleteBottle deletes bottle from bottlesbase.
func (*DB) GetAccount ¶
func (db *DB) GetAccount(id int) *AccountModel
GetAccount returns the account with given id if any, nil otherwise.
func (*DB) GetBottle ¶
func (db *DB) GetBottle(account, id int) *BottleModel
GetBottle returns the bottle with the given id from the given account or nil if not found.
func (*DB) GetBottles ¶
func (db *DB) GetBottles(account int) ([]*BottleModel, error)
GetBottles return the bottles from the given account.
func (*DB) GetBottlesByYears ¶
func (db *DB) GetBottlesByYears(account int, years []int) ([]*BottleModel, error)
GetBottlesByYears returns the bottles with the vintage in the given array from the given account.
func (*DB) NewAccount ¶
func (db *DB) NewAccount() *AccountModel
NewAccount creates a new blank account resource.
func (*DB) NewBottle ¶
func (db *DB) NewBottle(account int) *BottleModel
NewBottle creates a new bottle resource.
func (*DB) SaveAccount ¶
func (db *DB) SaveAccount(a *AccountModel)
SaveAccount "persists" the account.
func (*DB) SaveBottle ¶
func (db *DB) SaveBottle(b *BottleModel)
SaveBottle persists bottle to bottlesbase.