refactor: localize protobuf definitions
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
package group
|
||||
|
||||
import (
|
||||
protobuf "bsm/full/protobuf"
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
@@ -35,17 +34,17 @@ const (
|
||||
// 群组
|
||||
type BasicClient interface {
|
||||
// 搜索
|
||||
Search(ctx context.Context, in *protobuf.SearchRequest, opts ...grpc.CallOption) (*GroupsReply, error)
|
||||
Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*GroupsReply, error)
|
||||
// 获取群组列表
|
||||
Fetch(ctx context.Context, in *protobuf.Empty, opts ...grpc.CallOption) (*GroupsReply, error)
|
||||
Fetch(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GroupsReply, error)
|
||||
// 获取群组信息
|
||||
Get(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*GroupItem, error)
|
||||
Get(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*GroupItem, error)
|
||||
// 创建群组
|
||||
Create(ctx context.Context, in *GroupItem, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error)
|
||||
Create(ctx context.Context, in *GroupItem, opts ...grpc.CallOption) (*DataStatusReply, error)
|
||||
// 修改群组信息
|
||||
Modify(ctx context.Context, in *GroupItem, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error)
|
||||
Modify(ctx context.Context, in *GroupItem, opts ...grpc.CallOption) (*DataStatusReply, error)
|
||||
// 解散群组
|
||||
Disband(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error)
|
||||
Disband(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*DataStatusReply, error)
|
||||
}
|
||||
|
||||
type basicClient struct {
|
||||
@@ -56,7 +55,7 @@ func NewBasicClient(cc grpc.ClientConnInterface) BasicClient {
|
||||
return &basicClient{cc}
|
||||
}
|
||||
|
||||
func (c *basicClient) Search(ctx context.Context, in *protobuf.SearchRequest, opts ...grpc.CallOption) (*GroupsReply, error) {
|
||||
func (c *basicClient) Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*GroupsReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(GroupsReply)
|
||||
err := c.cc.Invoke(ctx, Basic_Search_FullMethodName, in, out, cOpts...)
|
||||
@@ -66,7 +65,7 @@ func (c *basicClient) Search(ctx context.Context, in *protobuf.SearchRequest, op
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *basicClient) Fetch(ctx context.Context, in *protobuf.Empty, opts ...grpc.CallOption) (*GroupsReply, error) {
|
||||
func (c *basicClient) Fetch(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GroupsReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(GroupsReply)
|
||||
err := c.cc.Invoke(ctx, Basic_Fetch_FullMethodName, in, out, cOpts...)
|
||||
@@ -76,7 +75,7 @@ func (c *basicClient) Fetch(ctx context.Context, in *protobuf.Empty, opts ...grp
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *basicClient) Get(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*GroupItem, error) {
|
||||
func (c *basicClient) Get(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*GroupItem, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(GroupItem)
|
||||
err := c.cc.Invoke(ctx, Basic_Get_FullMethodName, in, out, cOpts...)
|
||||
@@ -86,9 +85,9 @@ func (c *basicClient) Get(ctx context.Context, in *protobuf.IdentRequest, opts .
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *basicClient) Create(ctx context.Context, in *GroupItem, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error) {
|
||||
func (c *basicClient) Create(ctx context.Context, in *GroupItem, opts ...grpc.CallOption) (*DataStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.DataStatusReply)
|
||||
out := new(DataStatusReply)
|
||||
err := c.cc.Invoke(ctx, Basic_Create_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -96,9 +95,9 @@ func (c *basicClient) Create(ctx context.Context, in *GroupItem, opts ...grpc.Ca
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *basicClient) Modify(ctx context.Context, in *GroupItem, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error) {
|
||||
func (c *basicClient) Modify(ctx context.Context, in *GroupItem, opts ...grpc.CallOption) (*DataStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.DataStatusReply)
|
||||
out := new(DataStatusReply)
|
||||
err := c.cc.Invoke(ctx, Basic_Modify_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -106,9 +105,9 @@ func (c *basicClient) Modify(ctx context.Context, in *GroupItem, opts ...grpc.Ca
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *basicClient) Disband(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.DataStatusReply, error) {
|
||||
func (c *basicClient) Disband(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, Basic_Disband_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -123,17 +122,17 @@ func (c *basicClient) Disband(ctx context.Context, in *protobuf.IdentRequest, op
|
||||
// 群组
|
||||
type BasicServer interface {
|
||||
// 搜索
|
||||
Search(context.Context, *protobuf.SearchRequest) (*GroupsReply, error)
|
||||
Search(context.Context, *SearchRequest) (*GroupsReply, error)
|
||||
// 获取群组列表
|
||||
Fetch(context.Context, *protobuf.Empty) (*GroupsReply, error)
|
||||
Fetch(context.Context, *Empty) (*GroupsReply, error)
|
||||
// 获取群组信息
|
||||
Get(context.Context, *protobuf.IdentRequest) (*GroupItem, error)
|
||||
Get(context.Context, *IdentRequest) (*GroupItem, error)
|
||||
// 创建群组
|
||||
Create(context.Context, *GroupItem) (*protobuf.DataStatusReply, error)
|
||||
Create(context.Context, *GroupItem) (*DataStatusReply, error)
|
||||
// 修改群组信息
|
||||
Modify(context.Context, *GroupItem) (*protobuf.DataStatusReply, error)
|
||||
Modify(context.Context, *GroupItem) (*DataStatusReply, error)
|
||||
// 解散群组
|
||||
Disband(context.Context, *protobuf.IdentRequest) (*protobuf.DataStatusReply, error)
|
||||
Disband(context.Context, *IdentRequest) (*DataStatusReply, error)
|
||||
}
|
||||
|
||||
// UnimplementedBasicServer should be embedded to have
|
||||
@@ -143,22 +142,22 @@ type BasicServer interface {
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedBasicServer struct{}
|
||||
|
||||
func (UnimplementedBasicServer) Search(context.Context, *protobuf.SearchRequest) (*GroupsReply, error) {
|
||||
func (UnimplementedBasicServer) Search(context.Context, *SearchRequest) (*GroupsReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Search not implemented")
|
||||
}
|
||||
func (UnimplementedBasicServer) Fetch(context.Context, *protobuf.Empty) (*GroupsReply, error) {
|
||||
func (UnimplementedBasicServer) Fetch(context.Context, *Empty) (*GroupsReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Fetch not implemented")
|
||||
}
|
||||
func (UnimplementedBasicServer) Get(context.Context, *protobuf.IdentRequest) (*GroupItem, error) {
|
||||
func (UnimplementedBasicServer) Get(context.Context, *IdentRequest) (*GroupItem, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Get not implemented")
|
||||
}
|
||||
func (UnimplementedBasicServer) Create(context.Context, *GroupItem) (*protobuf.DataStatusReply, error) {
|
||||
func (UnimplementedBasicServer) Create(context.Context, *GroupItem) (*DataStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Create not implemented")
|
||||
}
|
||||
func (UnimplementedBasicServer) Modify(context.Context, *GroupItem) (*protobuf.DataStatusReply, error) {
|
||||
func (UnimplementedBasicServer) Modify(context.Context, *GroupItem) (*DataStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Modify not implemented")
|
||||
}
|
||||
func (UnimplementedBasicServer) Disband(context.Context, *protobuf.IdentRequest) (*protobuf.DataStatusReply, error) {
|
||||
func (UnimplementedBasicServer) Disband(context.Context, *IdentRequest) (*DataStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Disband not implemented")
|
||||
}
|
||||
func (UnimplementedBasicServer) testEmbeddedByValue() {}
|
||||
@@ -182,7 +181,7 @@ func RegisterBasicServer(s grpc.ServiceRegistrar, srv BasicServer) {
|
||||
}
|
||||
|
||||
func _Basic_Search_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(protobuf.SearchRequest)
|
||||
in := new(SearchRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -194,13 +193,13 @@ func _Basic_Search_Handler(srv interface{}, ctx context.Context, dec func(interf
|
||||
FullMethod: Basic_Search_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(BasicServer).Search(ctx, req.(*protobuf.SearchRequest))
|
||||
return srv.(BasicServer).Search(ctx, req.(*SearchRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Basic_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(protobuf.Empty)
|
||||
in := new(Empty)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -212,13 +211,13 @@ func _Basic_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interfa
|
||||
FullMethod: Basic_Fetch_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(BasicServer).Fetch(ctx, req.(*protobuf.Empty))
|
||||
return srv.(BasicServer).Fetch(ctx, req.(*Empty))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Basic_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
|
||||
}
|
||||
@@ -230,7 +229,7 @@ func _Basic_Get_Handler(srv interface{}, ctx context.Context, dec func(interface
|
||||
FullMethod: Basic_Get_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(BasicServer).Get(ctx, req.(*protobuf.IdentRequest))
|
||||
return srv.(BasicServer).Get(ctx, req.(*IdentRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
@@ -272,7 +271,7 @@ func _Basic_Modify_Handler(srv interface{}, ctx context.Context, dec func(interf
|
||||
}
|
||||
|
||||
func _Basic_Disband_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
|
||||
}
|
||||
@@ -284,7 +283,7 @@ func _Basic_Disband_Handler(srv interface{}, ctx context.Context, dec func(inter
|
||||
FullMethod: Basic_Disband_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(BasicServer).Disband(ctx, req.(*protobuf.IdentRequest))
|
||||
return srv.(BasicServer).Disband(ctx, req.(*IdentRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user