2019-10-11 14:08:50 +01:00
|
|
|
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
2020-03-30 23:58:32 +03:00
|
|
|
// source: store/service/proto/store.proto
|
2019-10-11 14:08:50 +01:00
|
|
|
|
|
|
|
package go_micro_store
|
|
|
|
|
|
|
|
import (
|
|
|
|
fmt "fmt"
|
|
|
|
proto "github.com/golang/protobuf/proto"
|
|
|
|
math "math"
|
|
|
|
)
|
|
|
|
|
|
|
|
import (
|
|
|
|
context "context"
|
2020-01-30 14:39:00 +03:00
|
|
|
client "github.com/micro/go-micro/v2/client"
|
|
|
|
server "github.com/micro/go-micro/v2/server"
|
2019-10-11 14:08:50 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
|
|
var _ = proto.Marshal
|
|
|
|
var _ = fmt.Errorf
|
|
|
|
var _ = math.Inf
|
|
|
|
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
|
|
// is compatible with the proto package it is being compiled against.
|
|
|
|
// A compilation error at this line likely means your copy of the
|
|
|
|
// proto package needs to be updated.
|
|
|
|
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
|
|
|
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
|
|
var _ context.Context
|
|
|
|
var _ client.Option
|
|
|
|
var _ server.Option
|
|
|
|
|
|
|
|
// Client API for Store service
|
|
|
|
|
|
|
|
type StoreService interface {
|
|
|
|
Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error)
|
|
|
|
Write(ctx context.Context, in *WriteRequest, opts ...client.CallOption) (*WriteResponse, error)
|
|
|
|
Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error)
|
2020-03-12 13:41:30 +00:00
|
|
|
List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (Store_ListService, error)
|
2019-10-11 14:08:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type storeService struct {
|
|
|
|
c client.Client
|
|
|
|
name string
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewStoreService(name string, c client.Client) StoreService {
|
|
|
|
return &storeService{
|
|
|
|
c: c,
|
|
|
|
name: name,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-12 13:41:30 +00:00
|
|
|
func (c *storeService) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ReadResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Store.Read", in)
|
|
|
|
out := new(ReadResponse)
|
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *storeService) Write(ctx context.Context, in *WriteRequest, opts ...client.CallOption) (*WriteResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Store.Write", in)
|
|
|
|
out := new(WriteResponse)
|
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *storeService) Delete(ctx context.Context, in *DeleteRequest, opts ...client.CallOption) (*DeleteResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Store.Delete", in)
|
|
|
|
out := new(DeleteResponse)
|
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
2019-10-23 22:05:39 +01:00
|
|
|
func (c *storeService) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (Store_ListService, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Store.List", &ListRequest{})
|
2019-10-11 14:08:50 +01:00
|
|
|
stream, err := c.c.Stream(ctx, req, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
if err := stream.Send(in); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2019-10-23 22:05:39 +01:00
|
|
|
return &storeServiceList{stream}, nil
|
2019-10-11 14:08:50 +01:00
|
|
|
}
|
|
|
|
|
2019-10-23 22:05:39 +01:00
|
|
|
type Store_ListService interface {
|
2020-03-12 13:41:30 +00:00
|
|
|
Context() context.Context
|
2019-10-11 14:08:50 +01:00
|
|
|
SendMsg(interface{}) error
|
|
|
|
RecvMsg(interface{}) error
|
|
|
|
Close() error
|
2019-10-23 22:05:39 +01:00
|
|
|
Recv() (*ListResponse, error)
|
2019-10-11 14:08:50 +01:00
|
|
|
}
|
|
|
|
|
2019-10-23 22:05:39 +01:00
|
|
|
type storeServiceList struct {
|
2019-10-11 14:08:50 +01:00
|
|
|
stream client.Stream
|
|
|
|
}
|
|
|
|
|
2019-10-23 22:05:39 +01:00
|
|
|
func (x *storeServiceList) Close() error {
|
2019-10-11 14:08:50 +01:00
|
|
|
return x.stream.Close()
|
|
|
|
}
|
|
|
|
|
2020-03-12 13:41:30 +00:00
|
|
|
func (x *storeServiceList) Context() context.Context {
|
|
|
|
return x.stream.Context()
|
|
|
|
}
|
|
|
|
|
2019-10-23 22:05:39 +01:00
|
|
|
func (x *storeServiceList) SendMsg(m interface{}) error {
|
2019-10-11 14:08:50 +01:00
|
|
|
return x.stream.Send(m)
|
|
|
|
}
|
|
|
|
|
2019-10-23 22:05:39 +01:00
|
|
|
func (x *storeServiceList) RecvMsg(m interface{}) error {
|
2019-10-11 14:08:50 +01:00
|
|
|
return x.stream.Recv(m)
|
|
|
|
}
|
|
|
|
|
2019-10-23 22:05:39 +01:00
|
|
|
func (x *storeServiceList) Recv() (*ListResponse, error) {
|
|
|
|
m := new(ListResponse)
|
2019-10-11 14:08:50 +01:00
|
|
|
err := x.stream.Recv(m)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return m, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Server API for Store service
|
|
|
|
|
|
|
|
type StoreHandler interface {
|
|
|
|
Read(context.Context, *ReadRequest, *ReadResponse) error
|
|
|
|
Write(context.Context, *WriteRequest, *WriteResponse) error
|
|
|
|
Delete(context.Context, *DeleteRequest, *DeleteResponse) error
|
2020-03-12 13:41:30 +00:00
|
|
|
List(context.Context, *ListRequest, Store_ListStream) error
|
2019-10-11 14:08:50 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func RegisterStoreHandler(s server.Server, hdlr StoreHandler, opts ...server.HandlerOption) error {
|
|
|
|
type store interface {
|
|
|
|
Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error
|
|
|
|
Write(ctx context.Context, in *WriteRequest, out *WriteResponse) error
|
|
|
|
Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error
|
2020-03-12 13:41:30 +00:00
|
|
|
List(ctx context.Context, stream server.Stream) error
|
2019-10-11 14:08:50 +01:00
|
|
|
}
|
|
|
|
type Store struct {
|
|
|
|
store
|
|
|
|
}
|
|
|
|
h := &storeHandler{hdlr}
|
|
|
|
return s.Handle(s.NewHandler(&Store{h}, opts...))
|
|
|
|
}
|
|
|
|
|
|
|
|
type storeHandler struct {
|
|
|
|
StoreHandler
|
|
|
|
}
|
|
|
|
|
2020-03-12 13:41:30 +00:00
|
|
|
func (h *storeHandler) Read(ctx context.Context, in *ReadRequest, out *ReadResponse) error {
|
|
|
|
return h.StoreHandler.Read(ctx, in, out)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *storeHandler) Write(ctx context.Context, in *WriteRequest, out *WriteResponse) error {
|
|
|
|
return h.StoreHandler.Write(ctx, in, out)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *storeHandler) Delete(ctx context.Context, in *DeleteRequest, out *DeleteResponse) error {
|
|
|
|
return h.StoreHandler.Delete(ctx, in, out)
|
|
|
|
}
|
|
|
|
|
2019-10-23 22:05:39 +01:00
|
|
|
func (h *storeHandler) List(ctx context.Context, stream server.Stream) error {
|
|
|
|
m := new(ListRequest)
|
2019-10-11 14:08:50 +01:00
|
|
|
if err := stream.Recv(m); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2019-10-23 22:05:39 +01:00
|
|
|
return h.StoreHandler.List(ctx, m, &storeListStream{stream})
|
2019-10-11 14:08:50 +01:00
|
|
|
}
|
|
|
|
|
2019-10-23 22:05:39 +01:00
|
|
|
type Store_ListStream interface {
|
2020-03-12 13:41:30 +00:00
|
|
|
Context() context.Context
|
2019-10-11 14:08:50 +01:00
|
|
|
SendMsg(interface{}) error
|
|
|
|
RecvMsg(interface{}) error
|
|
|
|
Close() error
|
2019-10-23 22:05:39 +01:00
|
|
|
Send(*ListResponse) error
|
2019-10-11 14:08:50 +01:00
|
|
|
}
|
|
|
|
|
2019-10-23 22:05:39 +01:00
|
|
|
type storeListStream struct {
|
2019-10-11 14:08:50 +01:00
|
|
|
stream server.Stream
|
|
|
|
}
|
|
|
|
|
2019-10-23 22:05:39 +01:00
|
|
|
func (x *storeListStream) Close() error {
|
2019-10-11 14:08:50 +01:00
|
|
|
return x.stream.Close()
|
|
|
|
}
|
|
|
|
|
2020-03-12 13:41:30 +00:00
|
|
|
func (x *storeListStream) Context() context.Context {
|
|
|
|
return x.stream.Context()
|
|
|
|
}
|
|
|
|
|
2019-10-23 22:05:39 +01:00
|
|
|
func (x *storeListStream) SendMsg(m interface{}) error {
|
2019-10-11 14:08:50 +01:00
|
|
|
return x.stream.Send(m)
|
|
|
|
}
|
|
|
|
|
2019-10-23 22:05:39 +01:00
|
|
|
func (x *storeListStream) RecvMsg(m interface{}) error {
|
2019-10-11 14:08:50 +01:00
|
|
|
return x.stream.Recv(m)
|
|
|
|
}
|
|
|
|
|
2019-10-23 22:05:39 +01:00
|
|
|
func (x *storeListStream) Send(m *ListResponse) error {
|
2019-10-11 14:08:50 +01:00
|
|
|
return x.stream.Send(m)
|
|
|
|
}
|