v1

package
v0.0.0-...-b73e152 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_product_v1_product_proto protoreflect.FileDescriptor
View Source
var ProductService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "product.v1.ProductService",
	HandlerType: (*ProductServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "AddProduct",
			Handler:    _ProductService_AddProduct_Handler,
		},
		{
			MethodName: "DeleteProduct",
			Handler:    _ProductService_DeleteProduct_Handler,
		},
		{
			MethodName: "ListProducts",
			Handler:    _ProductService_ListProducts_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "product/v1/product.proto",
}

ProductService_ServiceDesc is the grpc.ServiceDesc for ProductService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

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. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterProductServiceHandlerFromEndpoint instead.

func RegisterProductServiceServer

func RegisterProductServiceServer(s grpc.ServiceRegistrar, srv ProductServiceServer)

Types

type AddProductRequest

type AddProductRequest struct {
	Name  string  `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Price float64 `protobuf:"fixed64,2,opt,name=price,proto3" json:"price,omitempty"`
	// contains filtered or unexported fields
}

func (*AddProductRequest) Descriptor deprecated

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

Deprecated: Use AddProductRequest.ProtoReflect.Descriptor instead.

func (*AddProductRequest) GetName

func (x *AddProductRequest) GetName() string

func (*AddProductRequest) GetPrice

func (x *AddProductRequest) GetPrice() float64

func (*AddProductRequest) ProtoMessage

func (*AddProductRequest) ProtoMessage()

func (*AddProductRequest) ProtoReflect

func (x *AddProductRequest) ProtoReflect() protoreflect.Message

func (*AddProductRequest) Reset

func (x *AddProductRequest) Reset()

func (*AddProductRequest) String

func (x *AddProductRequest) String() string

type AddProductResponse

type AddProductResponse struct {
	ProductId string `protobuf:"bytes,1,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
	// contains filtered or unexported fields
}

func (*AddProductResponse) Descriptor deprecated

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

Deprecated: Use AddProductResponse.ProtoReflect.Descriptor instead.

func (*AddProductResponse) GetProductId

func (x *AddProductResponse) GetProductId() 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 DeleteProductRequest

type DeleteProductRequest struct {
	ProductId string `protobuf:"bytes,1,opt,name=product_id,json=productId,proto3" json:"product_id,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteProductRequest) Descriptor deprecated

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

Deprecated: Use DeleteProductRequest.ProtoReflect.Descriptor instead.

func (*DeleteProductRequest) GetProductId

func (x *DeleteProductRequest) GetProductId() string

func (*DeleteProductRequest) ProtoMessage

func (*DeleteProductRequest) ProtoMessage()

func (*DeleteProductRequest) ProtoReflect

func (x *DeleteProductRequest) ProtoReflect() protoreflect.Message

func (*DeleteProductRequest) Reset

func (x *DeleteProductRequest) Reset()

func (*DeleteProductRequest) String

func (x *DeleteProductRequest) String() string

type DeleteProductResponse

type DeleteProductResponse struct {
	Product *Product `protobuf:"bytes,1,opt,name=product,proto3" json:"product,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteProductResponse) Descriptor deprecated

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

Deprecated: Use DeleteProductResponse.ProtoReflect.Descriptor instead.

func (*DeleteProductResponse) GetProduct

func (x *DeleteProductResponse) GetProduct() *Product

func (*DeleteProductResponse) ProtoMessage

func (*DeleteProductResponse) ProtoMessage()

func (*DeleteProductResponse) ProtoReflect

func (x *DeleteProductResponse) ProtoReflect() protoreflect.Message

func (*DeleteProductResponse) Reset

func (x *DeleteProductResponse) Reset()

func (*DeleteProductResponse) String

func (x *DeleteProductResponse) String() string

type ListProductsRequest

type ListProductsRequest struct {
	// contains filtered or unexported fields
}

func (*ListProductsRequest) Descriptor deprecated

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

Deprecated: Use ListProductsRequest.ProtoReflect.Descriptor instead.

func (*ListProductsRequest) ProtoMessage

func (*ListProductsRequest) ProtoMessage()

func (*ListProductsRequest) ProtoReflect

func (x *ListProductsRequest) ProtoReflect() protoreflect.Message

func (*ListProductsRequest) Reset

func (x *ListProductsRequest) Reset()

func (*ListProductsRequest) String

func (x *ListProductsRequest) String() string

type ListProductsResponse

type ListProductsResponse struct {
	Products []*Product `protobuf:"bytes,1,rep,name=products,proto3" json:"products,omitempty"`
	// contains filtered or unexported fields
}

func (*ListProductsResponse) Descriptor deprecated

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

Deprecated: Use ListProductsResponse.ProtoReflect.Descriptor instead.

func (*ListProductsResponse) GetProducts

func (x *ListProductsResponse) GetProducts() []*Product

func (*ListProductsResponse) ProtoMessage

func (*ListProductsResponse) ProtoMessage()

func (*ListProductsResponse) ProtoReflect

func (x *ListProductsResponse) ProtoReflect() protoreflect.Message

func (*ListProductsResponse) Reset

func (x *ListProductsResponse) Reset()

func (*ListProductsResponse) String

func (x *ListProductsResponse) 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"`
	Price float64 `protobuf:"fixed64,3,opt,name=price,proto3" json:"price,omitempty"`
	// contains filtered or unexported fields
}

func (*Product) Descriptor deprecated

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

Deprecated: Use Product.ProtoReflect.Descriptor instead.

func (*Product) GetId

func (x *Product) GetId() string

func (*Product) GetName

func (x *Product) GetName() string

func (*Product) GetPrice

func (x *Product) GetPrice() float64

func (*Product) ProtoMessage

func (*Product) ProtoMessage()

func (*Product) ProtoReflect

func (x *Product) ProtoReflect() protoreflect.Message

func (*Product) Reset

func (x *Product) Reset()

func (*Product) String

func (x *Product) String() string

type ProductServiceClient

type ProductServiceClient interface {
	AddProduct(ctx context.Context, in *AddProductRequest, opts ...grpc.CallOption) (*AddProductResponse, error)
	DeleteProduct(ctx context.Context, in *DeleteProductRequest, opts ...grpc.CallOption) (*DeleteProductResponse, error)
	ListProducts(ctx context.Context, in *ListProductsRequest, opts ...grpc.CallOption) (*ListProductsResponse, error)
}

ProductServiceClient is the client API for ProductService 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.

type ProductServiceServer

type ProductServiceServer interface {
	AddProduct(context.Context, *AddProductRequest) (*AddProductResponse, error)
	DeleteProduct(context.Context, *DeleteProductRequest) (*DeleteProductResponse, error)
	ListProducts(context.Context, *ListProductsRequest) (*ListProductsResponse, error)
	// contains filtered or unexported methods
}

ProductServiceServer is the server API for ProductService service. All implementations must embed UnimplementedProductServiceServer for forward compatibility

type UnimplementedProductServiceServer

type UnimplementedProductServiceServer struct {
}

UnimplementedProductServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedProductServiceServer) AddProduct

func (UnimplementedProductServiceServer) DeleteProduct

func (UnimplementedProductServiceServer) ListProducts

type UnsafeProductServiceServer

type UnsafeProductServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeProductServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ProductServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

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