Documentation
¶
Overview ¶
Package petstorepb is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterStoreServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterStoreServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client StoreServiceClient) error
- func RegisterStoreServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterStoreServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server StoreServiceServer) error
- func RegisterStoreServiceServer(s grpc.ServiceRegistrar, srv StoreServiceServer)
- type AddProductResponse
- type ItemRequest
- type ItemResponse
- type Product
- func (*Product) Descriptor() ([]byte, []int)deprecated
- func (x *Product) GetCategory() string
- func (x *Product) GetId() string
- func (x *Product) GetName() string
- func (x *Product) GetPhotoUrl() string
- func (x *Product) GetStatus() Product_Status
- func (*Product) ProtoMessage()
- func (x *Product) ProtoReflect() protoreflect.Message
- func (x *Product) Reset()
- func (x *Product) String() string
- type Product_Status
- func (Product_Status) Descriptor() protoreflect.EnumDescriptor
- func (x Product_Status) Enum() *Product_Status
- func (Product_Status) EnumDescriptor() ([]byte, []int)deprecated
- func (x Product_Status) Number() protoreflect.EnumNumber
- func (x Product_Status) String() string
- func (Product_Status) Type() protoreflect.EnumType
- type StoreServiceClient
- type StoreServiceServer
- type UnimplementedStoreServiceServer
- type UnsafeStoreServiceServer
Constants ¶
This section is empty.
Variables ¶
var ( Product_Status_name = map[int32]string{ 0: "AVAILABLE", 1: "PENDING", 2: "SOLD", } Product_Status_value = map[string]int32{ "AVAILABLE": 0, "PENDING": 1, "SOLD": 2, } )
Enum value maps for Product_Status.
var File_petstorepb_petstore_proto protoreflect.FileDescriptor
var StoreService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "petstorepb.StoreService", HandlerType: (*StoreServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "AddProduct", Handler: _StoreService_AddProduct_Handler, }, { MethodName: "ListProduct", Handler: _StoreService_ListProduct_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "petstorepb/petstore.proto", }
StoreService_ServiceDesc is the grpc.ServiceDesc for StoreService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterStoreServiceHandler ¶
func RegisterStoreServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterStoreServiceHandler registers the http handlers for service StoreService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterStoreServiceHandlerClient ¶
func RegisterStoreServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client StoreServiceClient) error
RegisterStoreServiceHandlerClient registers the http handlers for service StoreService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "StoreServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "StoreServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "StoreServiceClient" to call the correct interceptors.
func RegisterStoreServiceHandlerFromEndpoint ¶
func RegisterStoreServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterStoreServiceHandlerFromEndpoint is same as RegisterStoreServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterStoreServiceHandlerServer ¶
func RegisterStoreServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server StoreServiceServer) error
RegisterStoreServiceHandlerServer registers the http handlers for service StoreService to "mux". UnaryRPC :call StoreServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterStoreServiceHandlerFromEndpoint instead.
func RegisterStoreServiceServer ¶
func RegisterStoreServiceServer(s grpc.ServiceRegistrar, srv StoreServiceServer)
Types ¶
type AddProductResponse ¶
type AddProductResponse struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
AddProductResponse defines newly created product id.
func (*AddProductResponse) Descriptor
deprecated
func (*AddProductResponse) Descriptor() ([]byte, []int)
Deprecated: Use AddProductResponse.ProtoReflect.Descriptor instead.
func (*AddProductResponse) GetId ¶
func (x *AddProductResponse) GetId() string
func (*AddProductResponse) ProtoMessage ¶
func (*AddProductResponse) ProtoMessage()
func (*AddProductResponse) ProtoReflect ¶
func (x *AddProductResponse) ProtoReflect() protoreflect.Message
func (*AddProductResponse) Reset ¶
func (x *AddProductResponse) Reset()
func (*AddProductResponse) String ¶
func (x *AddProductResponse) String() string
type ItemRequest ¶
type ItemRequest struct {
// contains filtered or unexported fields
}
ItemRequest represents store requests.
func (*ItemRequest) Descriptor
deprecated
func (*ItemRequest) Descriptor() ([]byte, []int)
Deprecated: Use ItemRequest.ProtoReflect.Descriptor instead.
func (*ItemRequest) ProtoMessage ¶
func (*ItemRequest) ProtoMessage()
func (*ItemRequest) ProtoReflect ¶
func (x *ItemRequest) ProtoReflect() protoreflect.Message
func (*ItemRequest) Reset ¶
func (x *ItemRequest) Reset()
func (*ItemRequest) String ¶
func (x *ItemRequest) String() string
type ItemResponse ¶
type ItemResponse struct { Products []*Product `protobuf:"bytes,1,rep,name=products,proto3" json:"products,omitempty"` // contains filtered or unexported fields }
ItemResponse defines search response.
func (*ItemResponse) Descriptor
deprecated
func (*ItemResponse) Descriptor() ([]byte, []int)
Deprecated: Use ItemResponse.ProtoReflect.Descriptor instead.
func (*ItemResponse) GetProducts ¶
func (x *ItemResponse) GetProducts() []*Product
func (*ItemResponse) ProtoMessage ¶
func (*ItemResponse) ProtoMessage()
func (*ItemResponse) ProtoReflect ¶
func (x *ItemResponse) ProtoReflect() protoreflect.Message
func (*ItemResponse) Reset ¶
func (x *ItemResponse) Reset()
func (*ItemResponse) String ¶
func (x *ItemResponse) String() string
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"` Category string `protobuf:"bytes,3,opt,name=category,proto3" json:"category,omitempty"` PhotoUrl string `protobuf:"bytes,4,opt,name=photo_url,json=photoUrl,proto3" json:"photo_url,omitempty"` Status Product_Status `protobuf:"varint,5,opt,name=status,proto3,enum=petstorepb.Product_Status" json:"status,omitempty"` // contains filtered or unexported fields }
Product defines an item in the pet store.
func (*Product) Descriptor
deprecated
func (*Product) GetCategory ¶
func (*Product) GetPhotoUrl ¶
func (*Product) GetStatus ¶
func (x *Product) GetStatus() Product_Status
func (*Product) ProtoMessage ¶
func (*Product) ProtoMessage()
func (*Product) ProtoReflect ¶
func (x *Product) ProtoReflect() protoreflect.Message
type Product_Status ¶
type Product_Status int32
const ( Product_AVAILABLE Product_Status = 0 Product_PENDING Product_Status = 1 Product_SOLD Product_Status = 2 )
func (Product_Status) Descriptor ¶
func (Product_Status) Descriptor() protoreflect.EnumDescriptor
func (Product_Status) Enum ¶
func (x Product_Status) Enum() *Product_Status
func (Product_Status) EnumDescriptor
deprecated
func (Product_Status) EnumDescriptor() ([]byte, []int)
Deprecated: Use Product_Status.Descriptor instead.
func (Product_Status) Number ¶
func (x Product_Status) Number() protoreflect.EnumNumber
func (Product_Status) String ¶
func (x Product_Status) String() string
func (Product_Status) Type ¶
func (Product_Status) Type() protoreflect.EnumType
type StoreServiceClient ¶
type StoreServiceClient interface { AddProduct(ctx context.Context, in *Product, opts ...grpc.CallOption) (*AddProductResponse, error) ListProduct(ctx context.Context, in *ItemRequest, opts ...grpc.CallOption) (*ItemResponse, error) }
StoreServiceClient is the client API for StoreService service.
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.
func NewStoreServiceClient ¶
func NewStoreServiceClient(cc grpc.ClientConnInterface) StoreServiceClient
type StoreServiceServer ¶
type StoreServiceServer interface { AddProduct(context.Context, *Product) (*AddProductResponse, error) ListProduct(context.Context, *ItemRequest) (*ItemResponse, error) // contains filtered or unexported methods }
StoreServiceServer is the server API for StoreService service. All implementations must embed UnimplementedStoreServiceServer for forward compatibility
type UnimplementedStoreServiceServer ¶
type UnimplementedStoreServiceServer struct { }
UnimplementedStoreServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedStoreServiceServer) AddProduct ¶
func (UnimplementedStoreServiceServer) AddProduct(context.Context, *Product) (*AddProductResponse, error)
func (UnimplementedStoreServiceServer) ListProduct ¶
func (UnimplementedStoreServiceServer) ListProduct(context.Context, *ItemRequest) (*ItemResponse, error)
type UnsafeStoreServiceServer ¶
type UnsafeStoreServiceServer interface {
// contains filtered or unexported methods
}
UnsafeStoreServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to StoreServiceServer will result in compilation errors.