1234567891011121314151617181920212223242526272829303132333435 |
- package todosvc
- import (
- "github.com/go-kit/kit/endpoint"
- "golang.org/x/net/context"
- )
- type Item struct {
- ID ID
- Title string
- Complete bool
- }
- type ID int64
- // Todo is a more advanced example then Add from addsvc.
- // It illustrates how to create an service with multiple endpoints combined in a single interface.
- type Todo interface {
- // Add adds a new Item and returns its ID
- Add(context.Context, string) (ID, error)
- // List returns a slice of all the items on this service
- List(context.Context) ([]Item, error)
- // Tooggle toggles the Complete field of an item
- Toggle(context.Context, ID) error
- // Delete removes the Item from the service
- Delete(context.Context, ID) error
- }
- type Endpoints struct {
- Add, List, Toggle, Delete endpoint.Endpoint
- }
|