store

package
v0.0.0-...-a4acd60 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateItem

func CreateItem(w http.ResponseWriter, c *Context, item *Item)

func DMP

func DMP(w http.ResponseWriter, r *http.Request, c *Context)

func InternalError

func InternalError(w http.ResponseWriter, c *Context, err error)

func ListItem

func ListItem(w http.ResponseWriter, c *Context)

func LogError

func LogError(c *Context, err error)

Types

type Context

type Context struct {
	Render    *render.Render
	DB        *DB
	IP        *net.IPAddr
	Namespace string
}

func NewContext

func NewContext(namespace string, db *DB) *Context

func (*Context) RenderError

func (c *Context) RenderError(w http.ResponseWriter, msg string, err error)

func (*Context) RenderJSON

func (c *Context) RenderJSON(w http.ResponseWriter, msg interface{})

type DB

type DB struct {
	// contains filtered or unexported fields
}

func NewDB

func NewDB(sqlPath string) (db *DB, err error)

func (*DB) Close

func (d *DB) Close()

func (*DB) CreateTable

func (d *DB) CreateTable() error

func (*DB) InsertItem

func (d *DB) InsertItem(name string, description string, price int) (item *Item, err error)

func (*DB) ListAllItem

func (d *DB) ListAllItem() (items []*Item, err error)

type Item

type Item struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Price       int    `json:"price"`
}

type Log

type Log struct {
	Addr      string `json:"address"`
	Namespace string `json:"namespace"`
	Cause     string `json:"cause"`
}

Jump to

Keyboard shortcuts

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