product

package
v0.0.0-...-fd4dc81 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package product is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterProductServiceHandler

func RegisterProductServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterProductServiceHandler registers the http handlers for service ProductService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterProductServiceHandlerClient

func RegisterProductServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ProductServiceClient) error

RegisterProductServiceHandlerClient registers the http handlers for service ProductService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ProductServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ProductServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ProductServiceClient" to call the correct interceptors.

func RegisterProductServiceHandlerFromEndpoint

func RegisterProductServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterProductServiceHandlerFromEndpoint is same as RegisterProductServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterProductServiceHandlerServer

func RegisterProductServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ProductServiceServer) error

RegisterProductServiceHandlerServer registers the http handlers for service ProductService to "mux". UnaryRPC :call ProductServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.

func RegisterProductServiceServer

func RegisterProductServiceServer(s *grpc.Server, srv ProductServiceServer)

Types

type CreateProductReq

type CreateProductReq struct {
	Product              *Product `protobuf:"bytes,1,opt,name=product,proto3" json:"product,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*CreateProductReq) Descriptor

func (*CreateProductReq) Descriptor() ([]byte, []int)

func (*CreateProductReq) GetProduct

func (m *CreateProductReq) GetProduct() *Product

func (*CreateProductReq) ProtoMessage

func (*CreateProductReq) ProtoMessage()

func (*CreateProductReq) Reset

func (m *CreateProductReq) Reset()

func (*CreateProductReq) String

func (m *CreateProductReq) String() string

func (*CreateProductReq) XXX_DiscardUnknown

func (m *CreateProductReq) XXX_DiscardUnknown()

func (*CreateProductReq) XXX_Marshal

func (m *CreateProductReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CreateProductReq) XXX_Merge

func (m *CreateProductReq) XXX_Merge(src proto.Message)

func (*CreateProductReq) XXX_Size

func (m *CreateProductReq) XXX_Size() int

func (*CreateProductReq) XXX_Unmarshal

func (m *CreateProductReq) XXX_Unmarshal(b []byte) error

type CreateProductResp

type CreateProductResp struct {
	Id                   string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*CreateProductResp) Descriptor

func (*CreateProductResp) Descriptor() ([]byte, []int)

func (*CreateProductResp) GetId

func (m *CreateProductResp) GetId() string

func (*CreateProductResp) ProtoMessage

func (*CreateProductResp) ProtoMessage()

func (*CreateProductResp) Reset

func (m *CreateProductResp) Reset()

func (*CreateProductResp) String

func (m *CreateProductResp) String() string

func (*CreateProductResp) XXX_DiscardUnknown

func (m *CreateProductResp) XXX_DiscardUnknown()

func (*CreateProductResp) XXX_Marshal

func (m *CreateProductResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CreateProductResp) XXX_Merge

func (m *CreateProductResp) XXX_Merge(src proto.Message)

func (*CreateProductResp) XXX_Size

func (m *CreateProductResp) XXX_Size() int

func (*CreateProductResp) XXX_Unmarshal

func (m *CreateProductResp) XXX_Unmarshal(b []byte) error

type Product

type Product struct {
	Id                   string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Name                 string   `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Description          string   `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
	Price                int32    `protobuf:"varint,4,opt,name=price,proto3" json:"price,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Product) Descriptor

func (*Product) Descriptor() ([]byte, []int)

func (*Product) GetDescription

func (m *Product) GetDescription() string

func (*Product) GetId

func (m *Product) GetId() string

func (*Product) GetName

func (m *Product) GetName() string

func (*Product) GetPrice

func (m *Product) GetPrice() int32

func (*Product) ProtoMessage

func (*Product) ProtoMessage()

func (*Product) Reset

func (m *Product) Reset()

func (*Product) String

func (m *Product) String() string

func (*Product) XXX_DiscardUnknown

func (m *Product) XXX_DiscardUnknown()

func (*Product) XXX_Marshal

func (m *Product) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Product) XXX_Merge

func (m *Product) XXX_Merge(src proto.Message)

func (*Product) XXX_Size

func (m *Product) XXX_Size() int

func (*Product) XXX_Unmarshal

func (m *Product) XXX_Unmarshal(b []byte) error

type ProductServiceClient

type ProductServiceClient interface {
	Create(ctx context.Context, in *CreateProductReq, opts ...grpc.CallOption) (*CreateProductResp, error)
	Read(ctx context.Context, in *ReadProductReq, opts ...grpc.CallOption) (*ReadProductResp, error)
}

ProductServiceClient is the client API for ProductService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

type ProductServiceServer

type ProductServiceServer interface {
	Create(context.Context, *CreateProductReq) (*CreateProductResp, error)
	Read(context.Context, *ReadProductReq) (*ReadProductResp, error)
}

ProductServiceServer is the server API for ProductService service.

type ReadProductReq

type ReadProductReq struct {
	Id                   string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ReadProductReq) Descriptor

func (*ReadProductReq) Descriptor() ([]byte, []int)

func (*ReadProductReq) GetId

func (m *ReadProductReq) GetId() string

func (*ReadProductReq) ProtoMessage

func (*ReadProductReq) ProtoMessage()

func (*ReadProductReq) Reset

func (m *ReadProductReq) Reset()

func (*ReadProductReq) String

func (m *ReadProductReq) String() string

func (*ReadProductReq) XXX_DiscardUnknown

func (m *ReadProductReq) XXX_DiscardUnknown()

func (*ReadProductReq) XXX_Marshal

func (m *ReadProductReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ReadProductReq) XXX_Merge

func (m *ReadProductReq) XXX_Merge(src proto.Message)

func (*ReadProductReq) XXX_Size

func (m *ReadProductReq) XXX_Size() int

func (*ReadProductReq) XXX_Unmarshal

func (m *ReadProductReq) XXX_Unmarshal(b []byte) error

type ReadProductResp

type ReadProductResp struct {
	Product              *Product `protobuf:"bytes,1,opt,name=product,proto3" json:"product,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ReadProductResp) Descriptor

func (*ReadProductResp) Descriptor() ([]byte, []int)

func (*ReadProductResp) GetProduct

func (m *ReadProductResp) GetProduct() *Product

func (*ReadProductResp) ProtoMessage

func (*ReadProductResp) ProtoMessage()

func (*ReadProductResp) Reset

func (m *ReadProductResp) Reset()

func (*ReadProductResp) String

func (m *ReadProductResp) String() string

func (*ReadProductResp) XXX_DiscardUnknown

func (m *ReadProductResp) XXX_DiscardUnknown()

func (*ReadProductResp) XXX_Marshal

func (m *ReadProductResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ReadProductResp) XXX_Merge

func (m *ReadProductResp) XXX_Merge(src proto.Message)

func (*ReadProductResp) XXX_Size

func (m *ReadProductResp) XXX_Size() int

func (*ReadProductResp) XXX_Unmarshal

func (m *ReadProductResp) XXX_Unmarshal(b []byte) error

type UnimplementedProductServiceServer

type UnimplementedProductServiceServer struct {
}

UnimplementedProductServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedProductServiceServer) Create

func (*UnimplementedProductServiceServer) Read

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL