v1

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	Shipping_Create_FullMethodName = "/shipping.v1.Shipping/Create"
)

Variables

View Source
var File_shipping_v1_shipping_proto protoreflect.FileDescriptor
View Source
var Shipping_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "shipping.v1.Shipping",
	HandlerType: (*ShippingServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Create",
			Handler:    _Shipping_Create_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "shipping/v1/shipping.proto",
}

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

Functions

func RegisterShippingHandler

func RegisterShippingHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterShippingHandler registers the http handlers for service Shipping to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterShippingHandlerClient

func RegisterShippingHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ShippingClient) error

RegisterShippingHandlerClient registers the http handlers for service Shipping to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ShippingClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ShippingClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ShippingClient" to call the correct interceptors. This client ignores the HTTP middlewares.

func RegisterShippingHandlerFromEndpoint

func RegisterShippingHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterShippingHandlerFromEndpoint is same as RegisterShippingHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterShippingHandlerServer

func RegisterShippingHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ShippingServer) error

RegisterShippingHandlerServer registers the http handlers for service Shipping to "mux". UnaryRPC :call ShippingServer 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 RegisterShippingHandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.

func RegisterShippingServer

func RegisterShippingServer(s grpc.ServiceRegistrar, srv ShippingServer)

Types

type CreateShippingRequest

type CreateShippingRequest struct {
	UserId  int64  `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	OrderId int64  `protobuf:"varint,2,opt,name=order_id,json=orderId,proto3" json:"order_id,omitempty"`
	Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateShippingRequest) Descriptor deprecated

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

Deprecated: Use CreateShippingRequest.ProtoReflect.Descriptor instead.

func (*CreateShippingRequest) GetAddress

func (x *CreateShippingRequest) GetAddress() string

func (*CreateShippingRequest) GetOrderId

func (x *CreateShippingRequest) GetOrderId() int64

func (*CreateShippingRequest) GetUserId

func (x *CreateShippingRequest) GetUserId() int64

func (*CreateShippingRequest) ProtoMessage

func (*CreateShippingRequest) ProtoMessage()

func (*CreateShippingRequest) ProtoReflect

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

func (*CreateShippingRequest) Reset

func (x *CreateShippingRequest) Reset()

func (*CreateShippingRequest) String

func (x *CreateShippingRequest) String() string

type CreateShippingResponse

type CreateShippingResponse struct {
	ShippingId int64 `protobuf:"varint,1,opt,name=shipping_id,json=shippingId,proto3" json:"shipping_id,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateShippingResponse) Descriptor deprecated

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

Deprecated: Use CreateShippingResponse.ProtoReflect.Descriptor instead.

func (*CreateShippingResponse) GetShippingId

func (x *CreateShippingResponse) GetShippingId() int64

func (*CreateShippingResponse) ProtoMessage

func (*CreateShippingResponse) ProtoMessage()

func (*CreateShippingResponse) ProtoReflect

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

func (*CreateShippingResponse) Reset

func (x *CreateShippingResponse) Reset()

func (*CreateShippingResponse) String

func (x *CreateShippingResponse) String() string

type ShippingClient

type ShippingClient interface {
	Create(ctx context.Context, in *CreateShippingRequest, opts ...grpc.CallOption) (*CreateShippingResponse, error)
}

ShippingClient is the client API for Shipping 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 NewShippingClient

func NewShippingClient(cc grpc.ClientConnInterface) ShippingClient

type ShippingServer

type ShippingServer interface {
	Create(context.Context, *CreateShippingRequest) (*CreateShippingResponse, error)
	// contains filtered or unexported methods
}

ShippingServer is the server API for Shipping service. All implementations must embed UnimplementedShippingServer for forward compatibility.

type UnimplementedShippingServer

type UnimplementedShippingServer struct{}

UnimplementedShippingServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedShippingServer) Create

type UnsafeShippingServer

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

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

Jump to

Keyboard shortcuts

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