refactor: localize protobuf definitions
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
package mall
|
||||
|
||||
import (
|
||||
protobuf "bsm/full/protobuf"
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
@@ -38,17 +37,17 @@ type StaffClient interface {
|
||||
// 登录
|
||||
Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginReply, error)
|
||||
// 获取工作人员列表
|
||||
Fetch(ctx context.Context, in *protobuf.MallFetchRequest, opts ...grpc.CallOption) (*StaffListReply, error)
|
||||
Fetch(ctx context.Context, in *MallFetchRequest, opts ...grpc.CallOption) (*StaffListReply, error)
|
||||
// 创建工作人员
|
||||
Create(ctx context.Context, in *StaffItem, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error)
|
||||
Create(ctx context.Context, in *StaffItem, opts ...grpc.CallOption) (*IdentityStatusReply, error)
|
||||
// 删除工作人员
|
||||
Delete(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error)
|
||||
Delete(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*IdentityStatusReply, error)
|
||||
// 获取个人信息
|
||||
GetProfile(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*StaffItem, error)
|
||||
GetProfile(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StaffItem, error)
|
||||
// 设置个人信息
|
||||
SetProfile(ctx context.Context, in *StaffItem, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error)
|
||||
SetProfile(ctx context.Context, in *StaffItem, opts ...grpc.CallOption) (*IdentityStatusReply, error)
|
||||
// 设置账号密码
|
||||
SetPassword(ctx context.Context, in *SetAccountRequest, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error)
|
||||
SetPassword(ctx context.Context, in *SetAccountRequest, opts ...grpc.CallOption) (*IdentityStatusReply, error)
|
||||
}
|
||||
|
||||
type staffClient struct {
|
||||
@@ -69,7 +68,7 @@ func (c *staffClient) Login(ctx context.Context, in *LoginRequest, opts ...grpc.
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *staffClient) Fetch(ctx context.Context, in *protobuf.MallFetchRequest, opts ...grpc.CallOption) (*StaffListReply, error) {
|
||||
func (c *staffClient) Fetch(ctx context.Context, in *MallFetchRequest, opts ...grpc.CallOption) (*StaffListReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StaffListReply)
|
||||
err := c.cc.Invoke(ctx, Staff_Fetch_FullMethodName, in, out, cOpts...)
|
||||
@@ -79,9 +78,9 @@ func (c *staffClient) Fetch(ctx context.Context, in *protobuf.MallFetchRequest,
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *staffClient) Create(ctx context.Context, in *StaffItem, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error) {
|
||||
func (c *staffClient) Create(ctx context.Context, in *StaffItem, opts ...grpc.CallOption) (*IdentityStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.IdentityStatusReply)
|
||||
out := new(IdentityStatusReply)
|
||||
err := c.cc.Invoke(ctx, Staff_Create_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -89,9 +88,9 @@ func (c *staffClient) Create(ctx context.Context, in *StaffItem, opts ...grpc.Ca
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *staffClient) Delete(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error) {
|
||||
func (c *staffClient) Delete(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*IdentityStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.IdentityStatusReply)
|
||||
out := new(IdentityStatusReply)
|
||||
err := c.cc.Invoke(ctx, Staff_Delete_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -99,7 +98,7 @@ func (c *staffClient) Delete(ctx context.Context, in *protobuf.IdentRequest, opt
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *staffClient) GetProfile(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*StaffItem, error) {
|
||||
func (c *staffClient) GetProfile(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StaffItem, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(StaffItem)
|
||||
err := c.cc.Invoke(ctx, Staff_GetProfile_FullMethodName, in, out, cOpts...)
|
||||
@@ -109,9 +108,9 @@ func (c *staffClient) GetProfile(ctx context.Context, in *protobuf.IdentRequest,
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *staffClient) SetProfile(ctx context.Context, in *StaffItem, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error) {
|
||||
func (c *staffClient) SetProfile(ctx context.Context, in *StaffItem, opts ...grpc.CallOption) (*IdentityStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.IdentityStatusReply)
|
||||
out := new(IdentityStatusReply)
|
||||
err := c.cc.Invoke(ctx, Staff_SetProfile_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -119,9 +118,9 @@ func (c *staffClient) SetProfile(ctx context.Context, in *StaffItem, opts ...grp
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *staffClient) SetPassword(ctx context.Context, in *SetAccountRequest, opts ...grpc.CallOption) (*protobuf.IdentityStatusReply, error) {
|
||||
func (c *staffClient) SetPassword(ctx context.Context, in *SetAccountRequest, opts ...grpc.CallOption) (*IdentityStatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.IdentityStatusReply)
|
||||
out := new(IdentityStatusReply)
|
||||
err := c.cc.Invoke(ctx, Staff_SetPassword_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -138,17 +137,17 @@ type StaffServer interface {
|
||||
// 登录
|
||||
Login(context.Context, *LoginRequest) (*LoginReply, error)
|
||||
// 获取工作人员列表
|
||||
Fetch(context.Context, *protobuf.MallFetchRequest) (*StaffListReply, error)
|
||||
Fetch(context.Context, *MallFetchRequest) (*StaffListReply, error)
|
||||
// 创建工作人员
|
||||
Create(context.Context, *StaffItem) (*protobuf.IdentityStatusReply, error)
|
||||
Create(context.Context, *StaffItem) (*IdentityStatusReply, error)
|
||||
// 删除工作人员
|
||||
Delete(context.Context, *protobuf.IdentRequest) (*protobuf.IdentityStatusReply, error)
|
||||
Delete(context.Context, *IdentRequest) (*IdentityStatusReply, error)
|
||||
// 获取个人信息
|
||||
GetProfile(context.Context, *protobuf.IdentRequest) (*StaffItem, error)
|
||||
GetProfile(context.Context, *IdentRequest) (*StaffItem, error)
|
||||
// 设置个人信息
|
||||
SetProfile(context.Context, *StaffItem) (*protobuf.IdentityStatusReply, error)
|
||||
SetProfile(context.Context, *StaffItem) (*IdentityStatusReply, error)
|
||||
// 设置账号密码
|
||||
SetPassword(context.Context, *SetAccountRequest) (*protobuf.IdentityStatusReply, error)
|
||||
SetPassword(context.Context, *SetAccountRequest) (*IdentityStatusReply, error)
|
||||
}
|
||||
|
||||
// UnimplementedStaffServer should be embedded to have
|
||||
@@ -161,22 +160,22 @@ type UnimplementedStaffServer struct{}
|
||||
func (UnimplementedStaffServer) Login(context.Context, *LoginRequest) (*LoginReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Login not implemented")
|
||||
}
|
||||
func (UnimplementedStaffServer) Fetch(context.Context, *protobuf.MallFetchRequest) (*StaffListReply, error) {
|
||||
func (UnimplementedStaffServer) Fetch(context.Context, *MallFetchRequest) (*StaffListReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Fetch not implemented")
|
||||
}
|
||||
func (UnimplementedStaffServer) Create(context.Context, *StaffItem) (*protobuf.IdentityStatusReply, error) {
|
||||
func (UnimplementedStaffServer) Create(context.Context, *StaffItem) (*IdentityStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Create not implemented")
|
||||
}
|
||||
func (UnimplementedStaffServer) Delete(context.Context, *protobuf.IdentRequest) (*protobuf.IdentityStatusReply, error) {
|
||||
func (UnimplementedStaffServer) Delete(context.Context, *IdentRequest) (*IdentityStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Delete not implemented")
|
||||
}
|
||||
func (UnimplementedStaffServer) GetProfile(context.Context, *protobuf.IdentRequest) (*StaffItem, error) {
|
||||
func (UnimplementedStaffServer) GetProfile(context.Context, *IdentRequest) (*StaffItem, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method GetProfile not implemented")
|
||||
}
|
||||
func (UnimplementedStaffServer) SetProfile(context.Context, *StaffItem) (*protobuf.IdentityStatusReply, error) {
|
||||
func (UnimplementedStaffServer) SetProfile(context.Context, *StaffItem) (*IdentityStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method SetProfile not implemented")
|
||||
}
|
||||
func (UnimplementedStaffServer) SetPassword(context.Context, *SetAccountRequest) (*protobuf.IdentityStatusReply, error) {
|
||||
func (UnimplementedStaffServer) SetPassword(context.Context, *SetAccountRequest) (*IdentityStatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method SetPassword not implemented")
|
||||
}
|
||||
func (UnimplementedStaffServer) testEmbeddedByValue() {}
|
||||
@@ -218,7 +217,7 @@ func _Staff_Login_Handler(srv interface{}, ctx context.Context, dec func(interfa
|
||||
}
|
||||
|
||||
func _Staff_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(protobuf.MallFetchRequest)
|
||||
in := new(MallFetchRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -230,7 +229,7 @@ func _Staff_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interfa
|
||||
FullMethod: Staff_Fetch_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(StaffServer).Fetch(ctx, req.(*protobuf.MallFetchRequest))
|
||||
return srv.(StaffServer).Fetch(ctx, req.(*MallFetchRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
@@ -254,7 +253,7 @@ func _Staff_Create_Handler(srv interface{}, ctx context.Context, dec func(interf
|
||||
}
|
||||
|
||||
func _Staff_Delete_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,13 +265,13 @@ func _Staff_Delete_Handler(srv interface{}, ctx context.Context, dec func(interf
|
||||
FullMethod: Staff_Delete_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(StaffServer).Delete(ctx, req.(*protobuf.IdentRequest))
|
||||
return srv.(StaffServer).Delete(ctx, req.(*IdentRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Staff_GetProfile_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 _Staff_GetProfile_Handler(srv interface{}, ctx context.Context, dec func(in
|
||||
FullMethod: Staff_GetProfile_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(StaffServer).GetProfile(ctx, req.(*protobuf.IdentRequest))
|
||||
return srv.(StaffServer).GetProfile(ctx, req.(*IdentRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user