todo

package
v0.0.0-...-86ca86c Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidId = errors.New("invalid id")

Functions

func DeleteHandler

func DeleteHandler(w rest.ResponseWriter, r *rest.Request)

func GetHandler

func GetHandler(w rest.ResponseWriter, r *rest.Request)

func MustInitRouter

func MustInitRouter() rest.App

func PingHandler

func PingHandler(w rest.ResponseWriter, r *rest.Request)

func UpdateHandler

func UpdateHandler(w rest.ResponseWriter, r *rest.Request)

Types

type MongoService

type MongoService struct {
	*mgo.Collection
}

func NewMongoService

func NewMongoService(db *mgo.Database) *MongoService

func (*MongoService) Delete

func (ms *MongoService) Delete(id uuid.UUID) error

func (*MongoService) Get

func (ms *MongoService) Get() ([]Todo, error)

func (*MongoService) Upsert

func (ms *MongoService) Upsert(t *Todo) error

type Service

type Service interface {
	Upsert(*Todo) error
	Get() ([]Todo, error)
	Delete(id uuid.UUID) error
}

type Todo

type Todo struct {
	Id        uuid.UUID `bson:"_id" json:"id"`
	Title     string    `bson:"title" json:"title"`
	Completed bool      `bson:"completed" json:"completed"`
	UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"`
}

type TodoService

type TodoService struct {
	Service
}

func NewTodoService

func NewTodoService(s Service) *TodoService

func (*TodoService) Upsert

func (ts *TodoService) Upsert(t *Todo) error

Jump to

Keyboard shortcuts

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