github.com/annwntech/go-micro/v2@v2.9.5/config/source/service/proto/service.pb.micro.go (about)

     1  // Code generated by protoc-gen-micro. DO NOT EDIT.
     2  // source: config/source/service/proto/service.proto
     3  
     4  package service
     5  
     6  import (
     7  	fmt "fmt"
     8  	proto "github.com/golang/protobuf/proto"
     9  	math "math"
    10  )
    11  
    12  import (
    13  	context "context"
    14  	api "github.com/annwntech/go-micro/v2/api"
    15  	client "github.com/annwntech/go-micro/v2/client"
    16  	server "github.com/annwntech/go-micro/v2/server"
    17  )
    18  
    19  // Reference imports to suppress errors if they are not otherwise used.
    20  var _ = proto.Marshal
    21  var _ = fmt.Errorf
    22  var _ = math.Inf
    23  
    24  // This is a compile-time assertion to ensure that this generated file
    25  // is compatible with the proto package it is being compiled against.
    26  // A compilation error at this line likely means your copy of the
    27  // proto package needs to be updated.
    28  const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
    29  
    30  // Reference imports to suppress errors if they are not otherwise used.
    31  var _ api.Endpoint
    32  var _ context.Context
    33  var _ client.Option
    34  var _ server.Option
    35  
    36  // Api Endpoints for Config service
    37  
    38  func NewConfigEndpoints() []*api.Endpoint {
    39  	return []*api.Endpoint{}
    40  }
    41  
    42  // Client API for Config service
    43  
    44  type ConfigService interface {
    45  	Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error)
    46  	Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error)
    47  	Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error)
    48  	List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
    49  	Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error)
    50  	Watch(ctx context.Context, in *WatchRequest, opts ...client.CallOption) (Config_WatchService, error)
    51  }
    52  
    53  type configService struct {
    54  	c    client.Client
    55  	name string
    56  }
    57  
    58  func NewConfigService(name string, c client.Client) ConfigService {
    59  	return &configService{
    60  		c:    c,
    61  		name: name,
    62  	}
    63  }
    64  
    65  func (c *configService) Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error) {
    66  	req := c.c.NewRequest(c.name, "Config.Create", in)
    67  	out := new(CreateResponse)
    68  	err := c.c.Call(ctx, req, out, opts...)
    69  	if err != nil {
    70  		return nil, err
    71  	}
    72  	return out, nil
    73  }
    74  
    75  func (c *configService) Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error) {
    76  	req := c.c.NewRequest(c.name, "Config.Update", in)
    77  	out := new(UpdateResponse)
    78  	err := c.c.Call(ctx, req, out, opts...)
    79  	if err != nil {
    80  		return nil, err
    81  	}
    82  	return out, nil
    83  }
    84  
    85  func (c *configService) Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) {
    86  	req := c.c.NewRequest(c.name, "Config.Delete", in)
    87  	out := new(DeleteResponse)
    88  	err := c.c.Call(ctx, req, out, opts...)
    89  	if err != nil {
    90  		return nil, err
    91  	}
    92  	return out, nil
    93  }
    94  
    95  func (c *configService) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) {
    96  	req := c.c.NewRequest(c.name, "Config.List", in)
    97  	out := new(ListResponse)
    98  	err := c.c.Call(ctx, req, out, opts...)
    99  	if err != nil {
   100  		return nil, err
   101  	}
   102  	return out, nil
   103  }
   104  
   105  func (c *configService) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) {
   106  	req := c.c.NewRequest(c.name, "Config.Read", in)
   107  	out := new(ReadResponse)
   108  	err := c.c.Call(ctx, req, out, opts...)
   109  	if err != nil {
   110  		return nil, err
   111  	}
   112  	return out, nil
   113  }
   114  
   115  func (c *configService) Watch(ctx context.Context, in *WatchRequest, opts ...client.CallOption) (Config_WatchService, error) {
   116  	req := c.c.NewRequest(c.name, "Config.Watch", &WatchRequest{})
   117  	stream, err := c.c.Stream(ctx, req, opts...)
   118  	if err != nil {
   119  		return nil, err
   120  	}
   121  	if err := stream.Send(in); err != nil {
   122  		return nil, err
   123  	}
   124  	return &configServiceWatch{stream}, nil
   125  }
   126  
   127  type Config_WatchService interface {
   128  	Context() context.Context
   129  	SendMsg(interface{}) error
   130  	RecvMsg(interface{}) error
   131  	Close() error
   132  	Recv() (*WatchResponse, error)
   133  }
   134  
   135  type configServiceWatch struct {
   136  	stream client.Stream
   137  }
   138  
   139  func (x *configServiceWatch) Close() error {
   140  	return x.stream.Close()
   141  }
   142  
   143  func (x *configServiceWatch) Context() context.Context {
   144  	return x.stream.Context()
   145  }
   146  
   147  func (x *configServiceWatch) SendMsg(m interface{}) error {
   148  	return x.stream.Send(m)
   149  }
   150  
   151  func (x *configServiceWatch) RecvMsg(m interface{}) error {
   152  	return x.stream.Recv(m)
   153  }
   154  
   155  func (x *configServiceWatch) Recv() (*WatchResponse, error) {
   156  	m := new(WatchResponse)
   157  	err := x.stream.Recv(m)
   158  	if err != nil {
   159  		return nil, err
   160  	}
   161  	return m, nil
   162  }
   163  
   164  // Server API for Config service
   165  
   166  type ConfigHandler interface {
   167  	Create(context.Context, *CreateRequest, *CreateResponse) error
   168  	Update(context.Context, *UpdateRequest, *UpdateResponse) error
   169  	Delete(context.Context, *DeleteRequest, *DeleteResponse) error
   170  	List(context.Context, *ListRequest, *ListResponse) error
   171  	Read(context.Context, *ReadRequest, *ReadResponse) error
   172  	Watch(context.Context, *WatchRequest, Config_WatchStream) error
   173  }
   174  
   175  func RegisterConfigHandler(s server.Server, hdlr ConfigHandler, opts ...server.HandlerOption) error {
   176  	type config interface {
   177  		Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error
   178  		Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error
   179  		Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error
   180  		List(ctx context.Context, in *ListRequest, out *ListResponse) error
   181  		Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error
   182  		Watch(ctx context.Context, stream server.Stream) error
   183  	}
   184  	type Config struct {
   185  		config
   186  	}
   187  	h := &configHandler{hdlr}
   188  	return s.Handle(s.NewHandler(&Config{h}, opts...))
   189  }
   190  
   191  type configHandler struct {
   192  	ConfigHandler
   193  }
   194  
   195  func (h *configHandler) Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error {
   196  	return h.ConfigHandler.Create(ctx, in, out)
   197  }
   198  
   199  func (h *configHandler) Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error {
   200  	return h.ConfigHandler.Update(ctx, in, out)
   201  }
   202  
   203  func (h *configHandler) Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error {
   204  	return h.ConfigHandler.Delete(ctx, in, out)
   205  }
   206  
   207  func (h *configHandler) List(ctx context.Context, in *ListRequest, out *ListResponse) error {
   208  	return h.ConfigHandler.List(ctx, in, out)
   209  }
   210  
   211  func (h *configHandler) Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error {
   212  	return h.ConfigHandler.Read(ctx, in, out)
   213  }
   214  
   215  func (h *configHandler) Watch(ctx context.Context, stream server.Stream) error {
   216  	m := new(WatchRequest)
   217  	if err := stream.Recv(m); err != nil {
   218  		return err
   219  	}
   220  	return h.ConfigHandler.Watch(ctx, m, &configWatchStream{stream})
   221  }
   222  
   223  type Config_WatchStream interface {
   224  	Context() context.Context
   225  	SendMsg(interface{}) error
   226  	RecvMsg(interface{}) error
   227  	Close() error
   228  	Send(*WatchResponse) error
   229  }
   230  
   231  type configWatchStream struct {
   232  	stream server.Stream
   233  }
   234  
   235  func (x *configWatchStream) Close() error {
   236  	return x.stream.Close()
   237  }
   238  
   239  func (x *configWatchStream) Context() context.Context {
   240  	return x.stream.Context()
   241  }
   242  
   243  func (x *configWatchStream) SendMsg(m interface{}) error {
   244  	return x.stream.Send(m)
   245  }
   246  
   247  func (x *configWatchStream) RecvMsg(m interface{}) error {
   248  	return x.stream.Recv(m)
   249  }
   250  
   251  func (x *configWatchStream) Send(m *WatchResponse) error {
   252  	return x.stream.Send(m)
   253  }