/
client.go
51 lines (43 loc) · 1.04 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
45
46
47
48
49
50
51
// Code generated by thriftrw-plugin-yarpc
// @generated
package fooclient
import (
yarpc "go.uber.org/yarpc"
transport "go.uber.org/yarpc/api/transport"
thrift "go.uber.org/yarpc/encoding/thrift"
nameclient "go.uber.org/yarpc/encoding/thrift/thriftrw-plugin-yarpc/internal/tests/extends/nameclient"
reflect "reflect"
)
// Interface is a client for the Foo service.
type Interface interface {
nameclient.Interface
}
// New builds a new client for the Foo service.
//
// client := fooclient.New(dispatcher.ClientConfig("foo"))
func New(c transport.ClientConfig, opts ...thrift.ClientOption) Interface {
return client{
c: thrift.New(thrift.Config{
Service: "Foo",
ClientConfig: c,
}, opts...),
Interface: nameclient.New(
c,
append(
opts,
thrift.Named("Foo"),
)...,
),
}
}
func init() {
yarpc.RegisterClientBuilder(
func(c transport.ClientConfig, f reflect.StructField) Interface {
return New(c, thrift.ClientBuilderOptions(c, f)...)
},
)
}
type client struct {
nameclient.Interface
c thrift.Client
}