workshop

package
v0.0.0-...-ba83c43 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: MIT Imports: 18 Imported by: 0

README

/api

Protobuf files and artifacts

  • protobuf definitions *.proto
  • gRPC server and client interfaces *.pb.go
  • Swagger *.swagger.json
  • grpc-gateway *.pb.gw.go

Documentation

Overview

Package workshop is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
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) Descriptor() ([]byte, []int)

Deprecated: Use Car.ProtoReflect.Descriptor instead.

func (*Car) GetBodyStyle

func (x *Car) GetBodyStyle() CarBody

func (*Car) GetColor

func (x *Car) GetColor() string

func (*Car) GetNumber

func (x *Car) GetNumber() string

func (*Car) GetOwner

func (x *Car) GetOwner() string

func (*Car) ProtoMessage

func (*Car) ProtoMessage()

func (*Car) ProtoReflect

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

func (*Car) Reset

func (x *Car) Reset()

func (*Car) String

func (x *Car) String() string

type CarBody

type CarBody int32
const (
	Car_SEDAN     CarBody = 0
	Car_PHAETON   CarBody = 1
	Car_HATCHBACK CarBody = 2
)

func (CarBody) Descriptor

func (CarBody) Descriptor() protoreflect.EnumDescriptor

func (CarBody) Enum

func (x CarBody) Enum() *CarBody

func (CarBody) EnumDescriptor deprecated

func (CarBody) EnumDescriptor() ([]byte, []int)

Deprecated: Use CarBody.Descriptor instead.

func (CarBody) Number

func (x CarBody) Number() protoreflect.EnumNumber

func (CarBody) String

func (x CarBody) String() string

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) AcceptCar

func (UnimplementedWorkshopServer) CarPainted

func (UnimplementedWorkshopServer) PaintCar

func (UnimplementedWorkshopServer) RetrieveCar

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

Jump to

Keyboard shortcuts

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