product

package
v0.0.0-...-cb82d97 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package product is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	ProductService_CreateProduct_FullMethodName = "/grpc.gateway.example.internal.adapter.api.v1.product.ProductService/CreateProduct"
	ProductService_GetProducts_FullMethodName   = "/grpc.gateway.example.internal.adapter.api.v1.product.ProductService/GetProducts"
	ProductService_GetProduct_FullMethodName    = "/grpc.gateway.example.internal.adapter.api.v1.product.ProductService/GetProduct"
	ProductService_DeleteProduct_FullMethodName = "/grpc.gateway.example.internal.adapter.api.v1.product.ProductService/DeleteProduct"
)

Variables

View Source
var File_internal_adapter_api_v1_product_product_proto protoreflect.FileDescriptor
View Source
var ProductService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "grpc.gateway.example.internal.adapter.api.v1.product.ProductService",
	HandlerType: (*ProductServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateProduct",
			Handler:    _ProductService_CreateProduct_Handler,
		},
		{
			MethodName: "GetProducts",
			Handler:    _ProductService_GetProducts_Handler,
		},
		{
			MethodName: "GetProduct",
			Handler:    _ProductService_GetProduct_Handler,
		},
		{
			MethodName: "DeleteProduct",
			Handler:    _ProductService_DeleteProduct_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "internal/adapter/api/v1/product/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 Aggregation

type Aggregation struct {
	Eq   *string `protobuf:"bytes,1,opt,name=eq,proto3,oneof" json:"eq,omitempty"`
	Like *string `protobuf:"bytes,2,opt,name=like,proto3,oneof" json:"like,omitempty"`
	// contains filtered or unexported fields
}

func (*Aggregation) Descriptor deprecated

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

Deprecated: Use Aggregation.ProtoReflect.Descriptor instead.

func (*Aggregation) GetEq

func (x *Aggregation) GetEq() string

func (*Aggregation) GetLike

func (x *Aggregation) GetLike() string

func (*Aggregation) ProtoMessage

func (*Aggregation) ProtoMessage()

func (*Aggregation) ProtoReflect

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

func (*Aggregation) Reset

func (x *Aggregation) Reset()

func (*Aggregation) String

func (x *Aggregation) String() string

type CreateProductBody

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

func (*CreateProductBody) Descriptor deprecated

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

Deprecated: Use CreateProductBody.ProtoReflect.Descriptor instead.

func (*CreateProductBody) GetDescription

func (x *CreateProductBody) GetDescription() string

func (*CreateProductBody) GetName

func (x *CreateProductBody) GetName() string

func (*CreateProductBody) GetPrice

func (x *CreateProductBody) GetPrice() float64

func (*CreateProductBody) ProtoMessage

func (*CreateProductBody) ProtoMessage()

func (*CreateProductBody) ProtoReflect

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

func (*CreateProductBody) Reset

func (x *CreateProductBody) Reset()

func (*CreateProductBody) String

func (x *CreateProductBody) String() string

type GetProductResponse

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

func (*GetProductResponse) Descriptor deprecated

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

Deprecated: Use GetProductResponse.ProtoReflect.Descriptor instead.

func (*GetProductResponse) GetProduct

func (x *GetProductResponse) GetProduct() *Product

func (*GetProductResponse) ProtoMessage

func (*GetProductResponse) ProtoMessage()

func (*GetProductResponse) ProtoReflect

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

func (*GetProductResponse) Reset

func (x *GetProductResponse) Reset()

func (*GetProductResponse) String

func (x *GetProductResponse) 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 Page

type Page struct {
	Size *string `protobuf:"bytes,1,opt,name=size,proto3,oneof" json:"size,omitempty"`
	Eq   *string `protobuf:"bytes,2,opt,name=eq,proto3,oneof" json:"eq,omitempty"`
	// contains filtered or unexported fields
}

func (*Page) Descriptor deprecated

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

Deprecated: Use Page.ProtoReflect.Descriptor instead.

func (*Page) GetEq

func (x *Page) GetEq() string

func (*Page) GetSize

func (x *Page) GetSize() string

func (*Page) ProtoMessage

func (*Page) ProtoMessage()

func (*Page) ProtoReflect

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

func (*Page) Reset

func (x *Page) Reset()

func (*Page) String

func (x *Page) 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"`
	Description string  `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
	Price       float64 `protobuf:"fixed64,4,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) GetDescription

func (x *Product) GetDescription() string

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 ProductId

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

func (*ProductId) Descriptor deprecated

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

Deprecated: Use ProductId.ProtoReflect.Descriptor instead.

func (*ProductId) GetId

func (x *ProductId) GetId() string

func (*ProductId) ProtoMessage

func (*ProductId) ProtoMessage()

func (*ProductId) ProtoReflect

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

func (*ProductId) Reset

func (x *ProductId) Reset()

func (*ProductId) String

func (x *ProductId) String() string

type ProductParams

type ProductParams struct {
	Page *Page        `protobuf:"bytes,1,opt,name=page,proto3,oneof" json:"page,omitempty"`
	Name *Aggregation `protobuf:"bytes,2,opt,name=name,proto3,oneof" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*ProductParams) Descriptor deprecated

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

Deprecated: Use ProductParams.ProtoReflect.Descriptor instead.

func (*ProductParams) GetName

func (x *ProductParams) GetName() *Aggregation

func (*ProductParams) GetPage

func (x *ProductParams) GetPage() *Page

func (*ProductParams) ProtoMessage

func (*ProductParams) ProtoMessage()

func (*ProductParams) ProtoReflect

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

func (*ProductParams) Reset

func (x *ProductParams) Reset()

func (*ProductParams) String

func (x *ProductParams) String() string

type ProductServiceClient

type ProductServiceClient interface {
	CreateProduct(ctx context.Context, in *CreateProductBody, opts ...grpc.CallOption) (*proto.Message, error)
	GetProducts(ctx context.Context, in *ProductParams, opts ...grpc.CallOption) (*ListProductsResponse, error)
	GetProduct(ctx context.Context, in *ProductId, opts ...grpc.CallOption) (*GetProductResponse, error)
	DeleteProduct(ctx context.Context, in *ProductId, opts ...grpc.CallOption) (*proto.Message, 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 {
	CreateProduct(context.Context, *CreateProductBody) (*proto.Message, error)
	GetProducts(context.Context, *ProductParams) (*ListProductsResponse, error)
	GetProduct(context.Context, *ProductId) (*GetProductResponse, error)
	DeleteProduct(context.Context, *ProductId) (*proto.Message, error)
	// contains filtered or unexported methods
}

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

func NewServer

func NewServer(productService service.ProductService, logger logging.Logger) ProductServiceServer

type UnimplementedProductServiceServer

type UnimplementedProductServiceServer struct {
}

UnimplementedProductServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedProductServiceServer) CreateProduct

func (UnimplementedProductServiceServer) DeleteProduct

func (UnimplementedProductServiceServer) GetProduct

func (UnimplementedProductServiceServer) GetProducts

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