refactor: localize protobuf definitions
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
package relation
|
||||
|
||||
import (
|
||||
protobuf "bsm/full/protobuf"
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
@@ -33,13 +32,13 @@ const (
|
||||
// relation-关系管理:匹配
|
||||
type MatchClient interface {
|
||||
// 获取匹配列表
|
||||
Fetch(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*protobuf.FetchRelationItemReply, error)
|
||||
Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FetchRelationItemReply, error)
|
||||
// 获取匹配详情
|
||||
Get(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.RelationItem, error)
|
||||
Get(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*RelationItem, error)
|
||||
// 执行通过,加为好友
|
||||
DoJoin(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error)
|
||||
DoJoin(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*DataStatusReply, error)
|
||||
// 执行忽略
|
||||
DoIgnore(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error)
|
||||
DoIgnore(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*DataStatusReply, error)
|
||||
}
|
||||
|
||||
type matchClient struct {
|
||||
@@ -50,9 +49,9 @@ func NewMatchClient(cc grpc.ClientConnInterface) MatchClient {
|
||||
return &matchClient{cc}
|
||||
}
|
||||
|
||||
func (c *matchClient) Fetch(ctx context.Context, in *protobuf.FetchRequest, opts ...grpc.CallOption) (*protobuf.FetchRelationItemReply, error) {
|
||||
func (c *matchClient) Fetch(ctx context.Context, in *FetchRequest, opts ...grpc.CallOption) (*FetchRelationItemReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.FetchRelationItemReply)
|
||||
out := new(FetchRelationItemReply)
|
||||
err := c.cc.Invoke(ctx, Match_Fetch_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -60,9 +59,9 @@ func (c *matchClient) Fetch(ctx context.Context, in *protobuf.FetchRequest, opts
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *matchClient) Get(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.RelationItem, error) {
|
||||
func (c *matchClient) Get(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*RelationItem, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.RelationItem)
|
||||
out := new(RelationItem)
|
||||
err := c.cc.Invoke(ctx, Match_Get_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -70,9 +69,9 @@ func (c *matchClient) Get(ctx context.Context, in *protobuf.IdentRequest, opts .
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *matchClient) DoJoin(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error) {
|
||||
func (c *matchClient) DoJoin(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*DataStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.DataStatusReply)
|
||||
out := new(DataStatusReply)
|
||||
err := c.cc.Invoke(ctx, Match_DoJoin_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -80,9 +79,9 @@ func (c *matchClient) DoJoin(ctx context.Context, in *protobuf.IdentRequest, opt
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *matchClient) DoIgnore(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error) {
|
||||
func (c *matchClient) DoIgnore(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*DataStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.DataStatusReply)
|
||||
out := new(DataStatusReply)
|
||||
err := c.cc.Invoke(ctx, Match_DoIgnore_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -97,13 +96,13 @@ func (c *matchClient) DoIgnore(ctx context.Context, in *protobuf.IdentRequest, o
|
||||
// relation-关系管理:匹配
|
||||
type MatchServer interface {
|
||||
// 获取匹配列表
|
||||
Fetch(context.Context, *protobuf.FetchRequest) (*protobuf.FetchRelationItemReply, error)
|
||||
Fetch(context.Context, *FetchRequest) (*FetchRelationItemReply, error)
|
||||
// 获取匹配详情
|
||||
Get(context.Context, *protobuf.IdentRequest) (*protobuf.RelationItem, error)
|
||||
Get(context.Context, *IdentRequest) (*RelationItem, error)
|
||||
// 执行通过,加为好友
|
||||
DoJoin(context.Context, *protobuf.IdentRequest) (*protobuf.DataStatusReply, error)
|
||||
DoJoin(context.Context, *IdentRequest) (*DataStatusReply, error)
|
||||
// 执行忽略
|
||||
DoIgnore(context.Context, *protobuf.IdentRequest) (*protobuf.DataStatusReply, error)
|
||||
DoIgnore(context.Context, *IdentRequest) (*DataStatusReply, error)
|
||||
}
|
||||
|
||||
// UnimplementedMatchServer should be embedded to have
|
||||
@@ -113,16 +112,16 @@ type MatchServer interface {
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedMatchServer struct{}
|
||||
|
||||
func (UnimplementedMatchServer) Fetch(context.Context, *protobuf.FetchRequest) (*protobuf.FetchRelationItemReply, error) {
|
||||
func (UnimplementedMatchServer) Fetch(context.Context, *FetchRequest) (*FetchRelationItemReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Fetch not implemented")
|
||||
}
|
||||
func (UnimplementedMatchServer) Get(context.Context, *protobuf.IdentRequest) (*protobuf.RelationItem, error) {
|
||||
func (UnimplementedMatchServer) Get(context.Context, *IdentRequest) (*RelationItem, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Get not implemented")
|
||||
}
|
||||
func (UnimplementedMatchServer) DoJoin(context.Context, *protobuf.IdentRequest) (*protobuf.DataStatusReply, error) {
|
||||
func (UnimplementedMatchServer) DoJoin(context.Context, *IdentRequest) (*DataStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method DoJoin not implemented")
|
||||
}
|
||||
func (UnimplementedMatchServer) DoIgnore(context.Context, *protobuf.IdentRequest) (*protobuf.DataStatusReply, error) {
|
||||
func (UnimplementedMatchServer) DoIgnore(context.Context, *IdentRequest) (*DataStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method DoIgnore not implemented")
|
||||
}
|
||||
func (UnimplementedMatchServer) testEmbeddedByValue() {}
|
||||
@@ -146,7 +145,7 @@ func RegisterMatchServer(s grpc.ServiceRegistrar, srv MatchServer) {
|
||||
}
|
||||
|
||||
func _Match_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(protobuf.FetchRequest)
|
||||
in := new(FetchRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -158,13 +157,13 @@ func _Match_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interfa
|
||||
FullMethod: Match_Fetch_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MatchServer).Fetch(ctx, req.(*protobuf.FetchRequest))
|
||||
return srv.(MatchServer).Fetch(ctx, req.(*FetchRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Match_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(protobuf.IdentRequest)
|
||||
in := new(IdentRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -176,13 +175,13 @@ func _Match_Get_Handler(srv interface{}, ctx context.Context, dec func(interface
|
||||
FullMethod: Match_Get_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MatchServer).Get(ctx, req.(*protobuf.IdentRequest))
|
||||
return srv.(MatchServer).Get(ctx, req.(*IdentRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Match_DoJoin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(protobuf.IdentRequest)
|
||||
in := new(IdentRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -194,13 +193,13 @@ func _Match_DoJoin_Handler(srv interface{}, ctx context.Context, dec func(interf
|
||||
FullMethod: Match_DoJoin_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MatchServer).DoJoin(ctx, req.(*protobuf.IdentRequest))
|
||||
return srv.(MatchServer).DoJoin(ctx, req.(*IdentRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Match_DoIgnore_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(protobuf.IdentRequest)
|
||||
in := new(IdentRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -212,7 +211,7 @@ func _Match_DoIgnore_Handler(srv interface{}, ctx context.Context, dec func(inte
|
||||
FullMethod: Match_DoIgnore_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MatchServer).DoIgnore(ctx, req.(*protobuf.IdentRequest))
|
||||
return srv.(MatchServer).DoIgnore(ctx, req.(*IdentRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user