forked from yarpc/yarpc-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.go
44 lines (36 loc) · 1.19 KB
/
client.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
// Code generated by thriftrw-plugin-yarpc
// @generated
package readonlystorefx
import (
fx "go.uber.org/fx"
yarpc "go.uber.org/yarpc"
thrift "go.uber.org/yarpc/encoding/thrift"
readonlystoreclient "go.uber.org/yarpc/encoding/thrift/thriftrw-plugin-yarpc/internal/tests/atomic/readonlystoreclient"
)
// Params defines the dependencies for the ReadOnlyStore client.
type Params struct {
fx.In
Provider yarpc.ClientConfig
}
// Result defines the output of the ReadOnlyStore client module. It provides a
// ReadOnlyStore client to an Fx application.
type Result struct {
fx.Out
Client readonlystoreclient.Interface
// We are using an fx.Out struct here instead of just returning a client
// so that we can add more values or add named versions of the client in
// the future without breaking any existing code.
}
// Client provides a ReadOnlyStore client to an Fx application using the given name
// for routing.
//
// fx.Provide(
// readonlystorefx.Client("..."),
// newHandler,
// )
func Client(name string, opts ...thrift.ClientOption) interface{} {
return func(p Params) Result {
client := readonlystoreclient.New(p.Provider.ClientConfig(name), opts...)
return Result{Client: client}
}
}