Documentation
¶
Overview ¶
Package workshop is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterWorkshopHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterWorkshopHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WorkshopClient) error
- func RegisterWorkshopHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterWorkshopHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WorkshopServer) error
- func RegisterWorkshopServer(s *grpc.Server, srv WorkshopServer)
- type Car
- func (*Car) Descriptor() ([]byte, []int)deprecated
- func (x *Car) GetBodyStyle() CarBody
- func (x *Car) GetColor() string
- func (x *Car) GetNumber() string
- func (x *Car) GetOwner() string
- func (*Car) ProtoMessage()
- func (x *Car) ProtoReflect() protoreflect.Message
- func (x *Car) Reset()
- func (x *Car) String() string
- type CarBody
- type PaintCarRequest
- func (*PaintCarRequest) Descriptor() ([]byte, []int)deprecated
- func (x *PaintCarRequest) GetCarNumber() string
- func (x *PaintCarRequest) GetDesiredColor() string
- func (*PaintCarRequest) ProtoMessage()
- func (x *PaintCarRequest) ProtoReflect() protoreflect.Message
- func (x *PaintCarRequest) Reset()
- func (x *PaintCarRequest) String() string
- type PaintFinishedRequest
- func (*PaintFinishedRequest) Descriptor() ([]byte, []int)deprecated
- func (x *PaintFinishedRequest) GetCarNumber() string
- func (x *PaintFinishedRequest) GetDesiredColor() string
- func (*PaintFinishedRequest) ProtoMessage()
- func (x *PaintFinishedRequest) ProtoReflect() protoreflect.Message
- func (x *PaintFinishedRequest) Reset()
- func (x *PaintFinishedRequest) String() string
- type RetrieveCarRequest
- func (*RetrieveCarRequest) Descriptor() ([]byte, []int)deprecated
- func (x *RetrieveCarRequest) GetCarNumber() string
- func (*RetrieveCarRequest) ProtoMessage()
- func (x *RetrieveCarRequest) ProtoReflect() protoreflect.Message
- func (x *RetrieveCarRequest) Reset()
- func (x *RetrieveCarRequest) String() string
- type UnimplementedWorkshopServer
- func (UnimplementedWorkshopServer) AcceptCar(context.Context, *Car) (*empty.Empty, error)
- func (UnimplementedWorkshopServer) CarPainted(context.Context, *PaintFinishedRequest) (*empty.Empty, error)
- func (UnimplementedWorkshopServer) PaintCar(context.Context, *PaintCarRequest) (*empty.Empty, error)
- func (UnimplementedWorkshopServer) RetrieveCar(context.Context, *RetrieveCarRequest) (*Car, error)
- type UnsafeWorkshopServer
- type WorkshopClient
- type WorkshopServer
Constants ¶
This section is empty.
Variables ¶
var ( CarBody_name = map[int32]string{ 0: "SEDAN", 1: "PHAETON", 2: "HATCHBACK", } CarBody_value = map[string]int32{ "SEDAN": 0, "PHAETON": 1, "HATCHBACK": 2, } )
Enum value maps for CarBody.
var File_api_workshop_proto protoreflect.FileDescriptor
Functions ¶
func RegisterWorkshopHandler ¶
func RegisterWorkshopHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterWorkshopHandler registers the http handlers for service Workshop to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterWorkshopHandlerClient ¶
func RegisterWorkshopHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WorkshopClient) error
RegisterWorkshopHandlerClient registers the http handlers for service Workshop to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "WorkshopClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "WorkshopClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "WorkshopClient" to call the correct interceptors.
func RegisterWorkshopHandlerFromEndpoint ¶
func RegisterWorkshopHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterWorkshopHandlerFromEndpoint is same as RegisterWorkshopHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterWorkshopHandlerServer ¶
func RegisterWorkshopHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WorkshopServer) error
RegisterWorkshopHandlerServer registers the http handlers for service Workshop to "mux". UnaryRPC :call WorkshopServer 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 RegisterWorkshopHandlerFromEndpoint instead.
func RegisterWorkshopServer ¶
func RegisterWorkshopServer(s *grpc.Server, srv WorkshopServer)
Types ¶
type Car ¶
type Car struct { Number string `protobuf:"bytes,1,opt,name=number,proto3" json:"number,omitempty"` Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` BodyStyle CarBody `protobuf:"varint,3,opt,name=body_style,json=bodyStyle,proto3,enum=demo.workshop.CarBody" json:"body_style,omitempty"` Color string `protobuf:"bytes,4,opt,name=color,proto3" json:"color,omitempty"` // contains filtered or unexported fields }
func (*Car) Descriptor
deprecated
func (*Car) GetBodyStyle ¶
func (*Car) ProtoMessage ¶
func (*Car) ProtoMessage()
func (*Car) ProtoReflect ¶
func (x *Car) ProtoReflect() protoreflect.Message
type CarBody ¶
type CarBody int32
func (CarBody) Descriptor ¶
func (CarBody) Descriptor() protoreflect.EnumDescriptor
func (CarBody) EnumDescriptor
deprecated
func (CarBody) Number ¶
func (x CarBody) Number() protoreflect.EnumNumber
func (CarBody) Type ¶
func (CarBody) Type() protoreflect.EnumType
type PaintCarRequest ¶
type PaintCarRequest struct { CarNumber string `protobuf:"bytes,1,opt,name=car_number,json=carNumber,proto3" json:"car_number,omitempty"` DesiredColor string `protobuf:"bytes,2,opt,name=desired_color,json=desiredColor,proto3" json:"desired_color,omitempty"` // contains filtered or unexported fields }
func (*PaintCarRequest) Descriptor
deprecated
func (*PaintCarRequest) Descriptor() ([]byte, []int)
Deprecated: Use PaintCarRequest.ProtoReflect.Descriptor instead.
func (*PaintCarRequest) GetCarNumber ¶
func (x *PaintCarRequest) GetCarNumber() string
func (*PaintCarRequest) GetDesiredColor ¶
func (x *PaintCarRequest) GetDesiredColor() string
func (*PaintCarRequest) ProtoMessage ¶
func (*PaintCarRequest) ProtoMessage()
func (*PaintCarRequest) ProtoReflect ¶
func (x *PaintCarRequest) ProtoReflect() protoreflect.Message
func (*PaintCarRequest) Reset ¶
func (x *PaintCarRequest) Reset()
func (*PaintCarRequest) String ¶
func (x *PaintCarRequest) String() string
type PaintFinishedRequest ¶
type PaintFinishedRequest struct { CarNumber string `protobuf:"bytes,1,opt,name=car_number,json=carNumber,proto3" json:"car_number,omitempty"` DesiredColor string `protobuf:"bytes,2,opt,name=desired_color,json=desiredColor,proto3" json:"desired_color,omitempty"` // contains filtered or unexported fields }
func (*PaintFinishedRequest) Descriptor
deprecated
func (*PaintFinishedRequest) Descriptor() ([]byte, []int)
Deprecated: Use PaintFinishedRequest.ProtoReflect.Descriptor instead.
func (*PaintFinishedRequest) GetCarNumber ¶
func (x *PaintFinishedRequest) GetCarNumber() string
func (*PaintFinishedRequest) GetDesiredColor ¶
func (x *PaintFinishedRequest) GetDesiredColor() string
func (*PaintFinishedRequest) ProtoMessage ¶
func (*PaintFinishedRequest) ProtoMessage()
func (*PaintFinishedRequest) ProtoReflect ¶
func (x *PaintFinishedRequest) ProtoReflect() protoreflect.Message
func (*PaintFinishedRequest) Reset ¶
func (x *PaintFinishedRequest) Reset()
func (*PaintFinishedRequest) String ¶
func (x *PaintFinishedRequest) String() string
type RetrieveCarRequest ¶
type RetrieveCarRequest struct { CarNumber string `protobuf:"bytes,1,opt,name=car_number,json=carNumber,proto3" json:"car_number,omitempty"` // contains filtered or unexported fields }
func (*RetrieveCarRequest) Descriptor
deprecated
func (*RetrieveCarRequest) Descriptor() ([]byte, []int)
Deprecated: Use RetrieveCarRequest.ProtoReflect.Descriptor instead.
func (*RetrieveCarRequest) GetCarNumber ¶
func (x *RetrieveCarRequest) GetCarNumber() string
func (*RetrieveCarRequest) ProtoMessage ¶
func (*RetrieveCarRequest) ProtoMessage()
func (*RetrieveCarRequest) ProtoReflect ¶
func (x *RetrieveCarRequest) ProtoReflect() protoreflect.Message
func (*RetrieveCarRequest) Reset ¶
func (x *RetrieveCarRequest) Reset()
func (*RetrieveCarRequest) String ¶
func (x *RetrieveCarRequest) String() string
type UnimplementedWorkshopServer ¶
type UnimplementedWorkshopServer struct { }
UnimplementedWorkshopServer must be embedded to have forward compatible implementations.
func (UnimplementedWorkshopServer) CarPainted ¶
func (UnimplementedWorkshopServer) CarPainted(context.Context, *PaintFinishedRequest) (*empty.Empty, error)
func (UnimplementedWorkshopServer) PaintCar ¶
func (UnimplementedWorkshopServer) PaintCar(context.Context, *PaintCarRequest) (*empty.Empty, error)
func (UnimplementedWorkshopServer) RetrieveCar ¶
func (UnimplementedWorkshopServer) RetrieveCar(context.Context, *RetrieveCarRequest) (*Car, error)
type UnsafeWorkshopServer ¶
type UnsafeWorkshopServer interface {
// contains filtered or unexported methods
}
UnsafeWorkshopServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to WorkshopServer will result in compilation errors.
type WorkshopClient ¶
type WorkshopClient interface { AcceptCar(ctx context.Context, in *Car, opts ...grpc.CallOption) (*empty.Empty, error) PaintCar(ctx context.Context, in *PaintCarRequest, opts ...grpc.CallOption) (*empty.Empty, error) RetrieveCar(ctx context.Context, in *RetrieveCarRequest, opts ...grpc.CallOption) (*Car, error) // CarPainted is gRPC only endpoint, used as a callback from Sub workshop CarPainted(ctx context.Context, in *PaintFinishedRequest, opts ...grpc.CallOption) (*empty.Empty, error) }
WorkshopClient is the client API for Workshop 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 NewWorkshopClient ¶
func NewWorkshopClient(cc grpc.ClientConnInterface) WorkshopClient
type WorkshopServer ¶
type WorkshopServer interface { AcceptCar(context.Context, *Car) (*empty.Empty, error) PaintCar(context.Context, *PaintCarRequest) (*empty.Empty, error) RetrieveCar(context.Context, *RetrieveCarRequest) (*Car, error) // CarPainted is gRPC only endpoint, used as a callback from Sub workshop CarPainted(context.Context, *PaintFinishedRequest) (*empty.Empty, error) // contains filtered or unexported methods }
WorkshopServer is the server API for Workshop service. All implementations must embed UnimplementedWorkshopServer for forward compatibility