productPb

package
v0.0.0-...-ebdf8ee Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package productPb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	ProductService_CreateProduct_FullMethodName  = "/productPb.ProductService/CreateProduct"
	ProductService_DeleteProduct_FullMethodName  = "/productPb.ProductService/DeleteProduct"
	ProductService_GetListProduct_FullMethodName = "/productPb.ProductService/GetListProduct"
	ProductService_GetProduct_FullMethodName     = "/productPb.ProductService/GetProduct"
	ProductService_UpdateProduct_FullMethodName  = "/productPb.ProductService/UpdateProduct"
)

Variables

View Source
var File_product_product_proto protoreflect.FileDescriptor
View Source
var ProductService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "productPb.ProductService",
	HandlerType: (*ProductServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateProduct",
			Handler:    _ProductService_CreateProduct_Handler,
		},
		{
			MethodName: "DeleteProduct",
			Handler:    _ProductService_DeleteProduct_Handler,
		},
		{
			MethodName: "GetListProduct",
			Handler:    _ProductService_GetListProduct_Handler,
		},
		{
			MethodName: "GetProduct",
			Handler:    _ProductService_GetProduct_Handler,
		},
		{
			MethodName: "UpdateProduct",
			Handler:    _ProductService_UpdateProduct_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "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 General

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

func (*General) Descriptor deprecated

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

Deprecated: Use General.ProtoReflect.Descriptor instead.

func (*General) GetMessage

func (x *General) GetMessage() string

func (*General) ProtoMessage

func (*General) ProtoMessage()

func (*General) ProtoReflect

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

func (*General) Reset

func (x *General) Reset()

func (*General) String

func (x *General) String() string

type GeneralFilter

type GeneralFilter struct {
	Q       string `protobuf:"bytes,1,opt,name=q,proto3" json:"q,omitempty"`
	OrderBy string `protobuf:"bytes,2,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"`
	Limit   uint32 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"`
	Offset  uint32 `protobuf:"varint,4,opt,name=offset,proto3" json:"offset,omitempty"`
	// contains filtered or unexported fields
}

func (*GeneralFilter) Descriptor deprecated

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

Deprecated: Use GeneralFilter.ProtoReflect.Descriptor instead.

func (*GeneralFilter) GetLimit

func (x *GeneralFilter) GetLimit() uint32

func (*GeneralFilter) GetOffset

func (x *GeneralFilter) GetOffset() uint32

func (*GeneralFilter) GetOrderBy

func (x *GeneralFilter) GetOrderBy() string

func (*GeneralFilter) GetQ

func (x *GeneralFilter) GetQ() string

func (*GeneralFilter) ProtoMessage

func (*GeneralFilter) ProtoMessage()

func (*GeneralFilter) ProtoReflect

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

func (*GeneralFilter) Reset

func (x *GeneralFilter) Reset()

func (*GeneralFilter) String

func (x *GeneralFilter) String() string

type GeneralIdRequest

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

func (*GeneralIdRequest) Descriptor deprecated

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

Deprecated: Use GeneralIdRequest.ProtoReflect.Descriptor instead.

func (*GeneralIdRequest) GetId

func (x *GeneralIdRequest) GetId() string

func (*GeneralIdRequest) ProtoMessage

func (*GeneralIdRequest) ProtoMessage()

func (*GeneralIdRequest) ProtoReflect

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

func (*GeneralIdRequest) Reset

func (x *GeneralIdRequest) Reset()

func (*GeneralIdRequest) String

func (x *GeneralIdRequest) String() string

type GeneralResponse

type GeneralResponse struct {
	Data *General `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*GeneralResponse) Descriptor deprecated

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

Deprecated: Use GeneralResponse.ProtoReflect.Descriptor instead.

func (*GeneralResponse) GetData

func (x *GeneralResponse) GetData() *General

func (*GeneralResponse) ProtoMessage

func (*GeneralResponse) ProtoMessage()

func (*GeneralResponse) ProtoReflect

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

func (*GeneralResponse) Reset

func (x *GeneralResponse) Reset()

func (*GeneralResponse) String

func (x *GeneralResponse) 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"`
	TypeSize     string `protobuf:"bytes,3,opt,name=type_size,json=typeSize,proto3" json:"type_size,omitempty"`
	Image        string `protobuf:"bytes,5,opt,name=image,proto3" json:"image,omitempty"`
	DefaultPrice uint64 `protobuf:"varint,6,opt,name=default_price,json=defaultPrice,proto3" json:"default_price,omitempty"`
	Price        uint64 `protobuf:"varint,7,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) GetDefaultPrice

func (x *Product) GetDefaultPrice() uint64

func (*Product) GetId

func (x *Product) GetId() string

func (*Product) GetImage

func (x *Product) GetImage() string

func (*Product) GetName

func (x *Product) GetName() string

func (*Product) GetPrice

func (x *Product) GetPrice() uint64

func (*Product) GetTypeSize

func (x *Product) GetTypeSize() string

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 ProductList

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

func (*ProductList) Descriptor deprecated

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

Deprecated: Use ProductList.ProtoReflect.Descriptor instead.

func (*ProductList) GetData

func (x *ProductList) GetData() []*Product

func (*ProductList) ProtoMessage

func (*ProductList) ProtoMessage()

func (*ProductList) ProtoReflect

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

func (*ProductList) Reset

func (x *ProductList) Reset()

func (*ProductList) String

func (x *ProductList) String() string

type ProductServiceClient

type ProductServiceClient interface {
	CreateProduct(ctx context.Context, in *Product, opts ...grpc.CallOption) (*GeneralResponse, error)
	DeleteProduct(ctx context.Context, in *GeneralIdRequest, opts ...grpc.CallOption) (*GeneralResponse, error)
	GetListProduct(ctx context.Context, in *GeneralFilter, opts ...grpc.CallOption) (*ProductList, error)
	GetProduct(ctx context.Context, in *GeneralIdRequest, opts ...grpc.CallOption) (*Product, error)
	UpdateProduct(ctx context.Context, in *Product, opts ...grpc.CallOption) (*GeneralResponse, 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, *Product) (*GeneralResponse, error)
	DeleteProduct(context.Context, *GeneralIdRequest) (*GeneralResponse, error)
	GetListProduct(context.Context, *GeneralFilter) (*ProductList, error)
	GetProduct(context.Context, *GeneralIdRequest) (*Product, error)
	UpdateProduct(context.Context, *Product) (*GeneralResponse, error)
}

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

type UnimplementedProductServiceServer

type UnimplementedProductServiceServer struct {
}

UnimplementedProductServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedProductServiceServer) CreateProduct

func (UnimplementedProductServiceServer) DeleteProduct

func (UnimplementedProductServiceServer) GetListProduct

func (UnimplementedProductServiceServer) GetProduct

func (UnimplementedProductServiceServer) UpdateProduct

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