refactor: localize protobuf definitions
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
package feed
|
||||
|
||||
import (
|
||||
protobuf "bsm/full/protobuf"
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
@@ -29,9 +28,9 @@ const (
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type SettingClient interface {
|
||||
// 修改个人信息
|
||||
Info(ctx context.Context, in *protobuf.Empty, opts ...grpc.CallOption) (*protobuf.Empty, error)
|
||||
Info(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error)
|
||||
// 修改权限信息
|
||||
Rights(ctx context.Context, in *protobuf.Empty, opts ...grpc.CallOption) (*protobuf.Empty, error)
|
||||
Rights(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error)
|
||||
}
|
||||
|
||||
type settingClient struct {
|
||||
@@ -42,9 +41,9 @@ func NewSettingClient(cc grpc.ClientConnInterface) SettingClient {
|
||||
return &settingClient{cc}
|
||||
}
|
||||
|
||||
func (c *settingClient) Info(ctx context.Context, in *protobuf.Empty, opts ...grpc.CallOption) (*protobuf.Empty, error) {
|
||||
func (c *settingClient) Info(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.Empty)
|
||||
out := new(Empty)
|
||||
err := c.cc.Invoke(ctx, Setting_Info_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -52,9 +51,9 @@ func (c *settingClient) Info(ctx context.Context, in *protobuf.Empty, opts ...gr
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *settingClient) Rights(ctx context.Context, in *protobuf.Empty, opts ...grpc.CallOption) (*protobuf.Empty, error) {
|
||||
func (c *settingClient) Rights(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(protobuf.Empty)
|
||||
out := new(Empty)
|
||||
err := c.cc.Invoke(ctx, Setting_Rights_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -67,9 +66,9 @@ func (c *settingClient) Rights(ctx context.Context, in *protobuf.Empty, opts ...
|
||||
// for forward compatibility.
|
||||
type SettingServer interface {
|
||||
// 修改个人信息
|
||||
Info(context.Context, *protobuf.Empty) (*protobuf.Empty, error)
|
||||
Info(context.Context, *Empty) (*Empty, error)
|
||||
// 修改权限信息
|
||||
Rights(context.Context, *protobuf.Empty) (*protobuf.Empty, error)
|
||||
Rights(context.Context, *Empty) (*Empty, error)
|
||||
}
|
||||
|
||||
// UnimplementedSettingServer should be embedded to have
|
||||
@@ -79,10 +78,10 @@ type SettingServer interface {
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedSettingServer struct{}
|
||||
|
||||
func (UnimplementedSettingServer) Info(context.Context, *protobuf.Empty) (*protobuf.Empty, error) {
|
||||
func (UnimplementedSettingServer) Info(context.Context, *Empty) (*Empty, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Info not implemented")
|
||||
}
|
||||
func (UnimplementedSettingServer) Rights(context.Context, *protobuf.Empty) (*protobuf.Empty, error) {
|
||||
func (UnimplementedSettingServer) Rights(context.Context, *Empty) (*Empty, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method Rights not implemented")
|
||||
}
|
||||
func (UnimplementedSettingServer) testEmbeddedByValue() {}
|
||||
@@ -106,7 +105,7 @@ func RegisterSettingServer(s grpc.ServiceRegistrar, srv SettingServer) {
|
||||
}
|
||||
|
||||
func _Setting_Info_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
|
||||
}
|
||||
@@ -118,13 +117,13 @@ func _Setting_Info_Handler(srv interface{}, ctx context.Context, dec func(interf
|
||||
FullMethod: Setting_Info_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SettingServer).Info(ctx, req.(*protobuf.Empty))
|
||||
return srv.(SettingServer).Info(ctx, req.(*Empty))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Setting_Rights_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
|
||||
}
|
||||
@@ -136,7 +135,7 @@ func _Setting_Rights_Handler(srv interface{}, ctx context.Context, dec func(inte
|
||||
FullMethod: Setting_Rights_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SettingServer).Rights(ctx, req.(*protobuf.Empty))
|
||||
return srv.(SettingServer).Rights(ctx, req.(*Empty))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user