refactor: localize protobuf definitions
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
package passport
|
||||
|
||||
import (
|
||||
protobuf "bsm/full/protobuf"
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
@@ -35,15 +34,15 @@ const (
|
||||
// assport通行证模块-帐号数据
|
||||
type AccountClient interface {
|
||||
// 通过会员所有信息
|
||||
Get(ctx context.Context, in *protobuf.Empty, opts ...grpc.CallOption) (*GetFullReply, error)
|
||||
Get(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetFullReply, error)
|
||||
// 更新会员的信息数据,字段值为空或是0,将不更新此数据
|
||||
SetData(ctx context.Context, in *SetDataRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error)
|
||||
SetData(ctx context.Context, in *SetDataRequest, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
// 更新会员的密码
|
||||
SetPassword(ctx context.Context, in *SetPasswordRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error)
|
||||
SetPassword(ctx context.Context, in *SetPasswordRequest, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
// 新增标签
|
||||
TagCreate(ctx context.Context, in *TagItem, opts ...grpc.CallOption) (*protobuf.StatusReply, error)
|
||||
TagCreate(ctx context.Context, in *TagItem, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
// 删除标签
|
||||
TagRemove(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error)
|
||||
TagRemove(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
// 获取会员的相关统计数据
|
||||
Statistics(ctx context.Context, in *StatisticsRequest, opts ...grpc.CallOption) (*StatisticsReply, error)
|
||||
}
|
||||
@@ -56,7 +55,7 @@ func NewAccountClient(cc grpc.ClientConnInterface) AccountClient {
|
||||
return &accountClient{cc}
|
||||
}
|
||||
|
||||
func (c *accountClient) Get(ctx context.Context, in *protobuf.Empty, opts ...grpc.CallOption) (*GetFullReply, error) {
|
||||
func (c *accountClient) Get(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetFullReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(GetFullReply)
|
||||
err := c.cc.Invoke(ctx, Account_Get_FullMethodName, in, out, cOpts...)
|
||||
@@ -66,9 +65,9 @@ func (c *accountClient) Get(ctx context.Context, in *protobuf.Empty, opts ...grp
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *accountClient) SetData(ctx context.Context, in *SetDataRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error) {
|
||||
func (c *accountClient) SetData(ctx context.Context, in *SetDataRequest, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.StatusReply)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Account_SetData_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -76,9 +75,9 @@ func (c *accountClient) SetData(ctx context.Context, in *SetDataRequest, opts ..
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *accountClient) SetPassword(ctx context.Context, in *SetPasswordRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error) {
|
||||
func (c *accountClient) SetPassword(ctx context.Context, in *SetPasswordRequest, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.StatusReply)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Account_SetPassword_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -86,9 +85,9 @@ func (c *accountClient) SetPassword(ctx context.Context, in *SetPasswordRequest,
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *accountClient) TagCreate(ctx context.Context, in *TagItem, opts ...grpc.CallOption) (*protobuf.StatusReply, error) {
|
||||
func (c *accountClient) TagCreate(ctx context.Context, in *TagItem, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.StatusReply)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Account_TagCreate_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -96,9 +95,9 @@ func (c *accountClient) TagCreate(ctx context.Context, in *TagItem, opts ...grpc
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *accountClient) TagRemove(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error) {
|
||||
func (c *accountClient) TagRemove(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.StatusReply)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Account_TagRemove_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -123,15 +122,15 @@ func (c *accountClient) Statistics(ctx context.Context, in *StatisticsRequest, o
|
||||
// assport通行证模块-帐号数据
|
||||
type AccountServer interface {
|
||||
// 通过会员所有信息
|
||||
Get(context.Context, *protobuf.Empty) (*GetFullReply, error)
|
||||
Get(context.Context, *Empty) (*GetFullReply, error)
|
||||
// 更新会员的信息数据,字段值为空或是0,将不更新此数据
|
||||
SetData(context.Context, *SetDataRequest) (*protobuf.StatusReply, error)
|
||||
SetData(context.Context, *SetDataRequest) (*StatusReply, error)
|
||||
// 更新会员的密码
|
||||
SetPassword(context.Context, *SetPasswordRequest) (*protobuf.StatusReply, error)
|
||||
SetPassword(context.Context, *SetPasswordRequest) (*StatusReply, error)
|
||||
// 新增标签
|
||||
TagCreate(context.Context, *TagItem) (*protobuf.StatusReply, error)
|
||||
TagCreate(context.Context, *TagItem) (*StatusReply, error)
|
||||
// 删除标签
|
||||
TagRemove(context.Context, *protobuf.IdentRequest) (*protobuf.StatusReply, error)
|
||||
TagRemove(context.Context, *IdentRequest) (*StatusReply, error)
|
||||
// 获取会员的相关统计数据
|
||||
Statistics(context.Context, *StatisticsRequest) (*StatisticsReply, error)
|
||||
}
|
||||
@@ -143,19 +142,19 @@ type AccountServer interface {
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedAccountServer struct{}
|
||||
|
||||
func (UnimplementedAccountServer) Get(context.Context, *protobuf.Empty) (*GetFullReply, error) {
|
||||
func (UnimplementedAccountServer) Get(context.Context, *Empty) (*GetFullReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Get not implemented")
|
||||
}
|
||||
func (UnimplementedAccountServer) SetData(context.Context, *SetDataRequest) (*protobuf.StatusReply, error) {
|
||||
func (UnimplementedAccountServer) SetData(context.Context, *SetDataRequest) (*StatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method SetData not implemented")
|
||||
}
|
||||
func (UnimplementedAccountServer) SetPassword(context.Context, *SetPasswordRequest) (*protobuf.StatusReply, error) {
|
||||
func (UnimplementedAccountServer) SetPassword(context.Context, *SetPasswordRequest) (*StatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method SetPassword not implemented")
|
||||
}
|
||||
func (UnimplementedAccountServer) TagCreate(context.Context, *TagItem) (*protobuf.StatusReply, error) {
|
||||
func (UnimplementedAccountServer) TagCreate(context.Context, *TagItem) (*StatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method TagCreate not implemented")
|
||||
}
|
||||
func (UnimplementedAccountServer) TagRemove(context.Context, *protobuf.IdentRequest) (*protobuf.StatusReply, error) {
|
||||
func (UnimplementedAccountServer) TagRemove(context.Context, *IdentRequest) (*StatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method TagRemove not implemented")
|
||||
}
|
||||
func (UnimplementedAccountServer) Statistics(context.Context, *StatisticsRequest) (*StatisticsReply, error) {
|
||||
@@ -182,7 +181,7 @@ func RegisterAccountServer(s grpc.ServiceRegistrar, srv AccountServer) {
|
||||
}
|
||||
|
||||
func _Account_Get_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
|
||||
}
|
||||
@@ -194,7 +193,7 @@ func _Account_Get_Handler(srv interface{}, ctx context.Context, dec func(interfa
|
||||
FullMethod: Account_Get_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AccountServer).Get(ctx, req.(*protobuf.Empty))
|
||||
return srv.(AccountServer).Get(ctx, req.(*Empty))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
@@ -254,7 +253,7 @@ func _Account_TagCreate_Handler(srv interface{}, ctx context.Context, dec func(i
|
||||
}
|
||||
|
||||
func _Account_TagRemove_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
|
||||
}
|
||||
@@ -266,7 +265,7 @@ func _Account_TagRemove_Handler(srv interface{}, ctx context.Context, dec func(i
|
||||
FullMethod: Account_TagRemove_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AccountServer).TagRemove(ctx, req.(*protobuf.IdentRequest))
|
||||
return srv.(AccountServer).TagRemove(ctx, req.(*IdentRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user