refactor: localize protobuf definitions
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
package cms
|
||||
|
||||
import (
|
||||
protobuf "bsm/full/protobuf"
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
@@ -41,11 +40,11 @@ type PagesClient interface {
|
||||
// 获取单页详情 By Key
|
||||
GetByKey(ctx context.Context, in *GetPagesByKeyRequest, opts ...grpc.CallOption) (*PagesItem, error)
|
||||
// 发布单页
|
||||
Create(ctx context.Context, in *PagesItem, opts ...grpc.CallOption) (*protobuf.StatusReply, error)
|
||||
Create(ctx context.Context, in *PagesItem, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
// 修改单页
|
||||
Modify(ctx context.Context, in *PagesItem, opts ...grpc.CallOption) (*protobuf.StatusReply, error)
|
||||
Modify(ctx context.Context, in *PagesItem, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
// 删除单页
|
||||
Delete(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error)
|
||||
Delete(ctx context.Context, in *IdentRequest, opts ...grpc.CallOption) (*StatusReply, error)
|
||||
}
|
||||
|
||||
type pagesClient struct {
|
||||
@@ -86,9 +85,9 @@ func (c *pagesClient) GetByKey(ctx context.Context, in *GetPagesByKeyRequest, op
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *pagesClient) Create(ctx context.Context, in *PagesItem, opts ...grpc.CallOption) (*protobuf.StatusReply, error) {
|
||||
func (c *pagesClient) Create(ctx context.Context, in *PagesItem, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.StatusReply)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Pages_Create_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -96,9 +95,9 @@ func (c *pagesClient) Create(ctx context.Context, in *PagesItem, opts ...grpc.Ca
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *pagesClient) Modify(ctx context.Context, in *PagesItem, opts ...grpc.CallOption) (*protobuf.StatusReply, error) {
|
||||
func (c *pagesClient) Modify(ctx context.Context, in *PagesItem, opts ...grpc.CallOption) (*StatusReply, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.StatusReply)
|
||||
out := new(StatusReply)
|
||||
err := c.cc.Invoke(ctx, Pages_Modify_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -106,9 +105,9 @@ func (c *pagesClient) Modify(ctx context.Context, in *PagesItem, opts ...grpc.Ca
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *pagesClient) Delete(ctx context.Context, in *protobuf.IdentRequest, opts ...grpc.CallOption) (*protobuf.StatusReply, error) {
|
||||
func (c *pagesClient) Delete(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, Pages_Delete_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -129,11 +128,11 @@ type PagesServer interface {
|
||||
// 获取单页详情 By Key
|
||||
GetByKey(context.Context, *GetPagesByKeyRequest) (*PagesItem, error)
|
||||
// 发布单页
|
||||
Create(context.Context, *PagesItem) (*protobuf.StatusReply, error)
|
||||
Create(context.Context, *PagesItem) (*StatusReply, error)
|
||||
// 修改单页
|
||||
Modify(context.Context, *PagesItem) (*protobuf.StatusReply, error)
|
||||
Modify(context.Context, *PagesItem) (*StatusReply, error)
|
||||
// 删除单页
|
||||
Delete(context.Context, *protobuf.IdentRequest) (*protobuf.StatusReply, error)
|
||||
Delete(context.Context, *IdentRequest) (*StatusReply, error)
|
||||
}
|
||||
|
||||
// UnimplementedPagesServer should be embedded to have
|
||||
@@ -152,13 +151,13 @@ func (UnimplementedPagesServer) GetByIdentity(context.Context, *GetPagesRequest)
|
||||
func (UnimplementedPagesServer) GetByKey(context.Context, *GetPagesByKeyRequest) (*PagesItem, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method GetByKey not implemented")
|
||||
}
|
||||
func (UnimplementedPagesServer) Create(context.Context, *PagesItem) (*protobuf.StatusReply, error) {
|
||||
func (UnimplementedPagesServer) Create(context.Context, *PagesItem) (*StatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Create not implemented")
|
||||
}
|
||||
func (UnimplementedPagesServer) Modify(context.Context, *PagesItem) (*protobuf.StatusReply, error) {
|
||||
func (UnimplementedPagesServer) Modify(context.Context, *PagesItem) (*StatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Modify not implemented")
|
||||
}
|
||||
func (UnimplementedPagesServer) Delete(context.Context, *protobuf.IdentRequest) (*protobuf.StatusReply, error) {
|
||||
func (UnimplementedPagesServer) Delete(context.Context, *IdentRequest) (*StatusReply, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Delete not implemented")
|
||||
}
|
||||
func (UnimplementedPagesServer) testEmbeddedByValue() {}
|
||||
@@ -272,7 +271,7 @@ func _Pages_Modify_Handler(srv interface{}, ctx context.Context, dec func(interf
|
||||
}
|
||||
|
||||
func _Pages_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
|
||||
}
|
||||
@@ -284,7 +283,7 @@ func _Pages_Delete_Handler(srv interface{}, ctx context.Context, dec func(interf
|
||||
FullMethod: Pages_Delete_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(PagesServer).Delete(ctx, req.(*protobuf.IdentRequest))
|
||||
return srv.(PagesServer).Delete(ctx, req.(*IdentRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user