-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.go
49 lines (39 loc) · 1.07 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
// Code generated by protoc-gen-go-client. DO NOT EDIT.
// versions:
// - protoc-gen-go-client v0.2.0
package myapp
import (
"context"
"google.golang.org/grpc"
)
type ClientConnInterface interface {
Invoke(ctx context.Context, method string, args interface{}, reply interface{}, opts ...grpc.CallOption) error
NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error)
Close() error
}
type Client interface {
ProjectService() ProjectServiceClient
UserService() UserServiceClient
Close() error
}
type client struct {
projectService ProjectServiceClient
userService UserServiceClient
cc ClientConnInterface
}
func New(cc ClientConnInterface) Client {
return &client{
projectService: NewProjectServiceClient(cc),
userService: NewUserServiceClient(cc),
cc: cc,
}
}
func (c *client) ProjectService() ProjectServiceClient {
return c.projectService
}
func (c *client) UserService() UserServiceClient {
return c.userService
}
func (c *client) Close() error {
return c.cc.Close()
}