-
Notifications
You must be signed in to change notification settings - Fork 0
/
todo.go
50 lines (41 loc) · 1.17 KB
/
todo.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package todoapi
import (
"context"
todo "github.com/too-common-name/todo-microservice/gen/todo"
"goa.design/clue/log"
)
// todo service example implementation.
// The example methods log the requests and return zero values.
type todosrvc struct{}
// NewTodo returns the todo service implementation.
func NewTodo() todo.Service {
return &todosrvc{}
}
// Create implements create.
func (s *todosrvc) Create(ctx context.Context, p *todo.Todo) (res *todo.Todo, err error) {
res = &todo.Todo{}
log.Printf(ctx, "todo.create")
return
}
// List implements list.
func (s *todosrvc) List(ctx context.Context) (res []*todo.Todo, err error) {
log.Printf(ctx, "todo.list")
return
}
// Get implements get.
func (s *todosrvc) Get(ctx context.Context, p *todo.GetPayload) (res *todo.Todo, err error) {
res = &todo.Todo{}
log.Printf(ctx, "todo.get")
return
}
// Delete a ToDo by ID
func (s *todosrvc) Delete(ctx context.Context, p *todo.DeletePayload) (err error) {
log.Printf(ctx, "todo.delete")
return
}
// Partially update a ToDo
func (s *todosrvc) Update(ctx context.Context, p *todo.UpdatePayload) (res *todo.Todo, err error) {
res = &todo.Todo{}
log.Printf(ctx, "todo.update")
return
}