-
Notifications
You must be signed in to change notification settings - Fork 14
/
app.go
41 lines (34 loc) · 1.35 KB
/
app.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
// Code generated by sysl DO NOT EDIT.
package simplegrpc
import (
"github.com/anz-bank/sysl-go/codegen/tests/simple"
"github.com/anz-bank/sysl-go/config"
"github.com/anz-bank/sysl-go/core"
"github.com/anz-bank/sysl-go/handlerinitialiser"
)
// DownstreamClients for SimpleGrpc
type DownstreamClients struct {
simpleClient *simple.Client
}
// BuildGrpcHandlerInitialiser ...
func BuildGrpcHandlerInitialiser(serviceInterface GrpcServiceInterface, callback core.GrpcGenCallback, downstream *DownstreamClients) handlerinitialiser.GrpcHandlerInitialiser {
serviceHandler := NewGrpcServiceHandler(callback, &serviceInterface, downstream.simpleClient)
return serviceHandler
}
// BuildDownstreamClients ...
func BuildDownstreamClients(cfg *config.DefaultConfig) (*DownstreamClients, error) {
var err error = nil
simpleHTTPClient, simpleErr := core.BuildDownstreamHTTPClient("simple", &cfg.GenCode.Downstream.(*DownstreamConfig).Simple)
if simpleErr != nil {
return nil, simpleErr
}
simpleClient := simple.NewClient(simpleHTTPClient, cfg.GenCode.Downstream.(*DownstreamConfig).Simple.ServiceURL)
return &DownstreamClients{simpleClient: simpleClient}, err
}
// NewDefaultConfig ...
func NewDefaultConfig() config.DefaultConfig {
return config.DefaultConfig{
Library: config.LibraryConfig{},
GenCode: config.GenCodeConfig{Downstream: &DownstreamConfig{}},
}
}