controllers

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: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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

Create records a new account.

func (*AccountController) Delete

Delete removes a account from the database.

func (*AccountController) Show

Show retrieves the account with the given id.

func (*AccountController) Update

Update updates a account field(s).

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

Create records a new bottle.

func (*BottleController) Delete

Delete removes a bottle from the database.

func (*BottleController) List

List lists all the bottles in the account optionally filtering by year.

func (*BottleController) Rate

Rate rates a bottle.

func (*BottleController) Show

Show retrieves the bottle with the given id.

func (*BottleController) Update

Update updates a bottle field(s).

type DB

type DB struct {
	sync.Mutex
	// contains filtered or unexported fields
}

DB emulates a database driver using in-memory data structures.

func NewDB

func NewDB() *DB

NewDB initializes a new "DB" with dummy data.

func (*DB) DeleteAccount

func (db *DB) DeleteAccount(account *app.Account)

DeleteAccount deletes the account.

func (*DB) DeleteBottle

func (db *DB) DeleteBottle(bottle *app.Bottle)

DeleteBottle deletes bottle from bottlesbase.

func (*DB) GetAccount

func (db *DB) GetAccount(id int) *app.Account

GetAccount returns the account with given id if any, nil otherwise.

func (*DB) GetBottle

func (db *DB) GetBottle(account, id int) *app.Bottle

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) ([]*app.Bottle, error)

GetBottles return the bottles from the given account.

func (*DB) GetBottlesByYears

func (db *DB) GetBottlesByYears(account int, years []int) ([]*app.Bottle, error)

GetBottlesByYears returns the bottles with the vintage in the given array from the given account.

func (*DB) NewAccount

func (db *DB) NewAccount() *app.Account

NewAccount creates a new blank account resource.

func (*DB) NewBottle

func (db *DB) NewBottle(account int) *app.Bottle

NewBottle creates a new bottle resource.

func (*DB) SaveAccount

func (db *DB) SaveAccount(a *app.Account)

SaveAccount "persists" the account.

func (*DB) SaveBottle

func (db *DB) SaveBottle(b *app.Bottle)

SaveBottle persists bottle to bottlesbase.

Jump to

Keyboard shortcuts

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