-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_service.go
58 lines (46 loc) · 1.51 KB
/
test_service.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
51
52
53
54
55
56
57
58
package main
import (
"time"
"app"
"handler"
// "github.com/jiuchen1986/Go-Microservice/app"
// "github.com/jiuchen1986/Go-Microservice/handler"
"github.com/goadesign/goa"
)
// TestServiceController implements the TestService resource.
type TestServiceController struct {
*goa.Controller
Delay time.Duration
}
// NewTestServiceController creates a TestService controller.
func NewTestServiceController(service *goa.Service, delay int64) *TestServiceController {
return &TestServiceController{Controller: service.NewController("TestServiceController"), Delay: time.Duration(delay)}
}
// LocalService runs the local_service action.
func (c *TestServiceController) LocalService(ctx *app.LocalServiceTestServiceContext) error {
// TestServiceController_LocalService: start_implement
// Put your logic here
if h, err := handler.NewHandler(ctx); err != nil {
return err
} else {
if e := h.Process(c.Delay); e != nil {
return e
}
}
// TestServiceController_LocalService: end_implement
return nil
}
// ServiceChain runs the service_chain action.
func (c *TestServiceController) ServiceChain(ctx *app.ServiceChainTestServiceContext) error {
// TestServiceController_ServiceChain: start_implement
// Put your logic here
if h, err := handler.NewHandler(ctx); err != nil {
return err
} else {
if e := h.Process(c.Delay); e != nil {
return e
}
}
// TestServiceController_ServiceChain: end_implement
return nil
}