handler

package
v0.0.0-...-f970054 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2016 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 Database

type Database interface {
	TodoFind(id string) (Todo, error)
	TodoUpsert(todo *Todo, returnNew bool) error
}

type Server

type Server struct {
	Database Database
}

START TYPE OMIT

func (*Server) TodoShow

func (s *Server) TodoShow(w http.ResponseWriter, r *http.Request)

START HANDLER1 OMIT

type Todo

type Todo struct {
	ID        TodoID    `bson:"_id"          json:"id"`
	Task      string    `bson:"t"            json:"task"`
	Created   time.Time `bson:"c"            json:"created"`
	Updated   time.Time `bson:"u,omitempty"  json:"updated"`
	Completed time.Time `bson:"cp,omitempty" json:"completed"`
}

Todo struct defines a task

type TodoID

type TodoID string

TodoID is the ID for a Todo task

func NewTodoID

func NewTodoID() TodoID

NewTodoID creates a new ID

func (TodoID) Blank

func (id TodoID) Blank() bool

Blank determines if a Todo is blank

func (TodoID) GetBSON

func (id TodoID) GetBSON() (v interface{}, e error)

GetBSON defines a custom unmarshaller to convert the BSON ObjectID to a TodoID

func (TodoID) Invalid

func (id TodoID) Invalid() bool

Invalid determines if the Todo is invalid

func (TodoID) Present

func (id TodoID) Present() bool

Present determines if the Todo is present

func (*TodoID) SetBSON

func (id *TodoID) SetBSON(raw bson.Raw) error

SetBSON defines a customer marshaller to convert at TodoID to a BSON ObjectID

func (TodoID) Valid

func (id TodoID) Valid() bool

Valid determines if a Todo is valid (has an valid ID)

Jump to

Keyboard shortcuts

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