productv1

package
v0.0.0-...-398e551 Latest Latest
Warning

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

Go to latest
Published: May 21, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package productv1 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: "Create",
			Handler:    _ProductService_Create_Handler,
		},
		{
			MethodName: "FindOne",
			Handler:    _ProductService_FindOne_Handler,
		},
		{
			MethodName: "DecreaseStock",
			Handler:    _ProductService_DecreaseStock_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 CreateRequest

type CreateRequest struct {
	Sku   string `protobuf:"bytes,1,opt,name=sku,proto3" json:"sku,omitempty"`
	Stock int64  `protobuf:"varint,2,opt,name=stock,proto3" json:"stock,omitempty"`
	Price int64  `protobuf:"varint,3,opt,name=price,proto3" json:"price,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateRequest) Descriptor deprecated

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

Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead.

func (*CreateRequest) GetPrice

func (x *CreateRequest) GetPrice() int64

func (*CreateRequest) GetSku

func (x *CreateRequest) GetSku() string

func (*CreateRequest) GetStock

func (x *CreateRequest) GetStock() int64

func (*CreateRequest) ProtoMessage

func (*CreateRequest) ProtoMessage()

func (*CreateRequest) ProtoReflect

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

func (*CreateRequest) Reset

func (x *CreateRequest) Reset()

func (*CreateRequest) String

func (x *CreateRequest) String() string

type CreateResponse

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

func (*CreateResponse) Descriptor deprecated

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

Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead.

func (*CreateResponse) GetId

func (x *CreateResponse) GetId() int64

func (*CreateResponse) ProtoMessage

func (*CreateResponse) ProtoMessage()

func (*CreateResponse) ProtoReflect

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

func (*CreateResponse) Reset

func (x *CreateResponse) Reset()

func (*CreateResponse) String

func (x *CreateResponse) String() string

type DecreaseStockRequest

type DecreaseStockRequest struct {
	Id      int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	OrderId int64 `protobuf:"varint,2,opt,name=order_id,proto3" json:"order_id,omitempty"`
	Count   int64 `protobuf:"varint,3,opt,name=count,proto3" json:"count,omitempty"`
	// contains filtered or unexported fields
}

func (*DecreaseStockRequest) Descriptor deprecated

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

Deprecated: Use DecreaseStockRequest.ProtoReflect.Descriptor instead.

func (*DecreaseStockRequest) GetCount

func (x *DecreaseStockRequest) GetCount() int64

func (*DecreaseStockRequest) GetId

func (x *DecreaseStockRequest) GetId() int64

func (*DecreaseStockRequest) GetOrderId

func (x *DecreaseStockRequest) GetOrderId() int64

func (*DecreaseStockRequest) ProtoMessage

func (*DecreaseStockRequest) ProtoMessage()

func (*DecreaseStockRequest) ProtoReflect

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

func (*DecreaseStockRequest) Reset

func (x *DecreaseStockRequest) Reset()

func (*DecreaseStockRequest) String

func (x *DecreaseStockRequest) String() string

type DecreaseStockResponse

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

func (*DecreaseStockResponse) Descriptor deprecated

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

Deprecated: Use DecreaseStockResponse.ProtoReflect.Descriptor instead.

func (*DecreaseStockResponse) ProtoMessage

func (*DecreaseStockResponse) ProtoMessage()

func (*DecreaseStockResponse) ProtoReflect

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

func (*DecreaseStockResponse) Reset

func (x *DecreaseStockResponse) Reset()

func (*DecreaseStockResponse) String

func (x *DecreaseStockResponse) String() string

type FindOneRequest

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

func (*FindOneRequest) Descriptor deprecated

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

Deprecated: Use FindOneRequest.ProtoReflect.Descriptor instead.

func (*FindOneRequest) GetId

func (x *FindOneRequest) GetId() int64

func (*FindOneRequest) ProtoMessage

func (*FindOneRequest) ProtoMessage()

func (*FindOneRequest) ProtoReflect

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

func (*FindOneRequest) Reset

func (x *FindOneRequest) Reset()

func (*FindOneRequest) String

func (x *FindOneRequest) String() string

type FindOneResponse

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

func (*FindOneResponse) Descriptor deprecated

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

Deprecated: Use FindOneResponse.ProtoReflect.Descriptor instead.

func (*FindOneResponse) GetProduct

func (x *FindOneResponse) GetProduct() *Product

func (*FindOneResponse) ProtoMessage

func (*FindOneResponse) ProtoMessage()

func (*FindOneResponse) ProtoReflect

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

func (*FindOneResponse) Reset

func (x *FindOneResponse) Reset()

func (*FindOneResponse) String

func (x *FindOneResponse) String() string

type Product

type Product struct {
	Id    int64  `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Sku   string `protobuf:"bytes,2,opt,name=sku,proto3" json:"sku,omitempty"`
	Stock int64  `protobuf:"varint,3,opt,name=stock,proto3" json:"stock,omitempty"`
	Price int64  `protobuf:"varint,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) GetId

func (x *Product) GetId() int64

func (*Product) GetPrice

func (x *Product) GetPrice() int64

func (*Product) GetSku

func (x *Product) GetSku() string

func (*Product) GetStock

func (x *Product) GetStock() int64

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 {
	Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error)
	FindOne(ctx context.Context, in *FindOneRequest, opts ...grpc.CallOption) (*FindOneResponse, error)
	DecreaseStock(ctx context.Context, in *DecreaseStockRequest, opts ...grpc.CallOption) (*DecreaseStockResponse, 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 {
	Create(context.Context, *CreateRequest) (*CreateResponse, error)
	FindOne(context.Context, *FindOneRequest) (*FindOneResponse, error)
	DecreaseStock(context.Context, *DecreaseStockRequest) (*DecreaseStockResponse, 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) Create

func (UnimplementedProductServiceServer) DecreaseStock

func (UnimplementedProductServiceServer) FindOne

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