gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/runtime/service/proto/runtime.pb.micro.go (about)

     1  // Code generated by protoc-gen-micro. DO NOT EDIT.
     2  // source: micro/go-micro/runtime/service/proto/runtime.proto
     3  
     4  package go_micro_runtime
     5  
     6  import (
     7  	fmt "fmt"
     8  	proto "github.com/golang/protobuf/proto"
     9  	math "math"
    10  )
    11  
    12  import (
    13  	context "context"
    14  	client "gitee.com/liuxuezhan/go-micro-v1.18.0/client"
    15  	server "gitee.com/liuxuezhan/go-micro-v1.18.0/server"
    16  )
    17  
    18  // Reference imports to suppress errors if they are not otherwise used.
    19  var _ = proto.Marshal
    20  var _ = fmt.Errorf
    21  var _ = math.Inf
    22  
    23  // This is a compile-time assertion to ensure that this generated file
    24  // is compatible with the proto package it is being compiled against.
    25  // A compilation error at this line likely means your copy of the
    26  // proto package needs to be updated.
    27  const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
    28  
    29  // Reference imports to suppress errors if they are not otherwise used.
    30  var _ context.Context
    31  var _ client.Option
    32  var _ server.Option
    33  
    34  // Client API for Runtime service
    35  
    36  type RuntimeService interface {
    37  	Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error)
    38  	Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error)
    39  	Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error)
    40  	Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error)
    41  	List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
    42  }
    43  
    44  type runtimeService struct {
    45  	c    client.Client
    46  	name string
    47  }
    48  
    49  func NewRuntimeService(name string, c client.Client) RuntimeService {
    50  	if c == nil {
    51  		c = client.NewClient()
    52  	}
    53  	if len(name) == 0 {
    54  		name = "go.micro.runtime"
    55  	}
    56  	return &runtimeService{
    57  		c:    c,
    58  		name: name,
    59  	}
    60  }
    61  
    62  func (c *runtimeService) Create(ctx context.Context, in *CreateRequest, opts ...client.CallOption) (*CreateResponse, error) {
    63  	req := c.c.NewRequest(c.name, "Runtime.Create", in)
    64  	out := new(CreateResponse)
    65  	err := c.c.Call(ctx, req, out, opts...)
    66  	if err != nil {
    67  		return nil, err
    68  	}
    69  	return out, nil
    70  }
    71  
    72  func (c *runtimeService) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) {
    73  	req := c.c.NewRequest(c.name, "Runtime.Read", in)
    74  	out := new(ReadResponse)
    75  	err := c.c.Call(ctx, req, out, opts...)
    76  	if err != nil {
    77  		return nil, err
    78  	}
    79  	return out, nil
    80  }
    81  
    82  func (c *runtimeService) Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) {
    83  	req := c.c.NewRequest(c.name, "Runtime.Delete", in)
    84  	out := new(DeleteResponse)
    85  	err := c.c.Call(ctx, req, out, opts...)
    86  	if err != nil {
    87  		return nil, err
    88  	}
    89  	return out, nil
    90  }
    91  
    92  func (c *runtimeService) Update(ctx context.Context, in *UpdateRequest, opts ...client.CallOption) (*UpdateResponse, error) {
    93  	req := c.c.NewRequest(c.name, "Runtime.Update", in)
    94  	out := new(UpdateResponse)
    95  	err := c.c.Call(ctx, req, out, opts...)
    96  	if err != nil {
    97  		return nil, err
    98  	}
    99  	return out, nil
   100  }
   101  
   102  func (c *runtimeService) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) {
   103  	req := c.c.NewRequest(c.name, "Runtime.List", in)
   104  	out := new(ListResponse)
   105  	err := c.c.Call(ctx, req, out, opts...)
   106  	if err != nil {
   107  		return nil, err
   108  	}
   109  	return out, nil
   110  }
   111  
   112  // Server API for Runtime service
   113  
   114  type RuntimeHandler interface {
   115  	Create(context.Context, *CreateRequest, *CreateResponse) error
   116  	Read(context.Context, *ReadRequest, *ReadResponse) error
   117  	Delete(context.Context, *DeleteRequest, *DeleteResponse) error
   118  	Update(context.Context, *UpdateRequest, *UpdateResponse) error
   119  	List(context.Context, *ListRequest, *ListResponse) error
   120  }
   121  
   122  func RegisterRuntimeHandler(s server.Server, hdlr RuntimeHandler, opts ...server.HandlerOption) error {
   123  	type runtime interface {
   124  		Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error
   125  		Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error
   126  		Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error
   127  		Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error
   128  		List(ctx context.Context, in *ListRequest, out *ListResponse) error
   129  	}
   130  	type Runtime struct {
   131  		runtime
   132  	}
   133  	h := &runtimeHandler{hdlr}
   134  	return s.Handle(s.NewHandler(&Runtime{h}, opts...))
   135  }
   136  
   137  type runtimeHandler struct {
   138  	RuntimeHandler
   139  }
   140  
   141  func (h *runtimeHandler) Create(ctx context.Context, in *CreateRequest, out *CreateResponse) error {
   142  	return h.RuntimeHandler.Create(ctx, in, out)
   143  }
   144  
   145  func (h *runtimeHandler) Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error {
   146  	return h.RuntimeHandler.Read(ctx, in, out)
   147  }
   148  
   149  func (h *runtimeHandler) Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error {
   150  	return h.RuntimeHandler.Delete(ctx, in, out)
   151  }
   152  
   153  func (h *runtimeHandler) Update(ctx context.Context, in *UpdateRequest, out *UpdateResponse) error {
   154  	return h.RuntimeHandler.Update(ctx, in, out)
   155  }
   156  
   157  func (h *runtimeHandler) List(ctx context.Context, in *ListRequest, out *ListResponse) error {
   158  	return h.RuntimeHandler.List(ctx, in, out)
   159  }