proto

package
v0.0.0-...-3bfa8a4 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package proto is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	Beer_BeerType_name = map[int32]string{
		0: "IndianPaleAle",
		1: "SessionIpa",
		2: "Lager",
	}
	Beer_BeerType_value = map[string]int32{
		"IndianPaleAle": 0,
		"SessionIpa":    1,
		"Lager":         2,
	}
)

Enum value maps for Beer_BeerType.

View Source
var BeerService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "beer.BeerService",
	HandlerType: (*BeerServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "AllBeers",
			Handler:    _BeerService_AllBeers_Handler,
		},
		{
			MethodName: "GetBeer",
			Handler:    _BeerService_GetBeer_Handler,
		},
		{
			MethodName: "CreateBeer",
			Handler:    _BeerService_CreateBeer_Handler,
		},
		{
			MethodName: "UpdateBeer",
			Handler:    _BeerService_UpdateBeer_Handler,
		},
		{
			MethodName: "DeleteBeer",
			Handler:    _BeerService_DeleteBeer_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "beer.proto",
}

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

Functions

func RegisterBeerServiceHandler

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

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

func RegisterBeerServiceHandlerClient

func RegisterBeerServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client BeerServiceClient) error

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

func RegisterBeerServiceHandlerFromEndpoint

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

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

func RegisterBeerServiceHandlerServer

func RegisterBeerServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BeerServiceServer) error

RegisterBeerServiceHandlerServer registers the http handlers for service BeerService to "mux". UnaryRPC :call BeerServiceServer 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 RegisterBeerServiceHandlerFromEndpoint instead.

func RegisterBeerServiceServer

func RegisterBeerServiceServer(s grpc.ServiceRegistrar, srv BeerServiceServer)

Types

type Beer

type Beer struct {
	Asin    string        `protobuf:"bytes,1,opt,name=asin,proto3" json:"asin,omitempty"`
	Name    string        `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Brand   string        `protobuf:"bytes,3,opt,name=brand,proto3" json:"brand,omitempty"`
	Country string        `protobuf:"bytes,4,opt,name=country,proto3" json:"country,omitempty"`
	Alcohol float32       `protobuf:"fixed32,5,opt,name=alcohol,proto3" json:"alcohol,omitempty"`
	Type    Beer_BeerType `protobuf:"varint,6,opt,name=type,proto3,enum=beer.Beer_BeerType" json:"type,omitempty"`
	// contains filtered or unexported fields
}

func (*Beer) Descriptor deprecated

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

Deprecated: Use Beer.ProtoReflect.Descriptor instead.

func (*Beer) GetAlcohol

func (x *Beer) GetAlcohol() float32

func (*Beer) GetAsin

func (x *Beer) GetAsin() string

func (*Beer) GetBrand

func (x *Beer) GetBrand() string

func (*Beer) GetCountry

func (x *Beer) GetCountry() string

func (*Beer) GetName

func (x *Beer) GetName() string

func (*Beer) GetType

func (x *Beer) GetType() Beer_BeerType

func (*Beer) ProtoMessage

func (*Beer) ProtoMessage()

func (*Beer) ProtoReflect

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

func (*Beer) Reset

func (x *Beer) Reset()

func (*Beer) String

func (x *Beer) String() string

type BeerServiceClient

type BeerServiceClient interface {
	// Get the list of all beers
	AllBeers(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetBeersResponse, error)
	// Get a single beer by Asin
	GetBeer(ctx context.Context, in *GetBeerRequest, opts ...grpc.CallOption) (*GetBeerResponse, error)
	// Create a new beer
	CreateBeer(ctx context.Context, in *CreateBeerRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Update an existing beer
	UpdateBeer(ctx context.Context, in *UpdateBeerRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Delete an existing beeer
	DeleteBeer(ctx context.Context, in *DeleteBeerRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

BeerServiceClient is the client API for BeerService 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 BeerServiceServer

type BeerServiceServer interface {
	// Get the list of all beers
	AllBeers(context.Context, *emptypb.Empty) (*GetBeersResponse, error)
	// Get a single beer by Asin
	GetBeer(context.Context, *GetBeerRequest) (*GetBeerResponse, error)
	// Create a new beer
	CreateBeer(context.Context, *CreateBeerRequest) (*emptypb.Empty, error)
	// Update an existing beer
	UpdateBeer(context.Context, *UpdateBeerRequest) (*emptypb.Empty, error)
	// Delete an existing beeer
	DeleteBeer(context.Context, *DeleteBeerRequest) (*emptypb.Empty, error)
	// contains filtered or unexported methods
}

BeerServiceServer is the server API for BeerService service. All implementations must embed UnimplementedBeerServiceServer for forward compatibility

type Beer_BeerType

type Beer_BeerType int32
const (
	Beer_IndianPaleAle Beer_BeerType = 0
	Beer_SessionIpa    Beer_BeerType = 1
	Beer_Lager         Beer_BeerType = 2
)

func (Beer_BeerType) Descriptor

func (Beer_BeerType) Enum

func (x Beer_BeerType) Enum() *Beer_BeerType

func (Beer_BeerType) EnumDescriptor deprecated

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

Deprecated: Use Beer_BeerType.Descriptor instead.

func (Beer_BeerType) Number

func (Beer_BeerType) String

func (x Beer_BeerType) String() string

func (Beer_BeerType) Type

type CreateBeerRequest

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

func (*CreateBeerRequest) Descriptor deprecated

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

Deprecated: Use CreateBeerRequest.ProtoReflect.Descriptor instead.

func (*CreateBeerRequest) GetBeer

func (x *CreateBeerRequest) GetBeer() *Beer

func (*CreateBeerRequest) ProtoMessage

func (*CreateBeerRequest) ProtoMessage()

func (*CreateBeerRequest) ProtoReflect

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

func (*CreateBeerRequest) Reset

func (x *CreateBeerRequest) Reset()

func (*CreateBeerRequest) String

func (x *CreateBeerRequest) String() string

type DeleteBeerRequest

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

func (*DeleteBeerRequest) Descriptor deprecated

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

Deprecated: Use DeleteBeerRequest.ProtoReflect.Descriptor instead.

func (*DeleteBeerRequest) GetAsin

func (x *DeleteBeerRequest) GetAsin() string

func (*DeleteBeerRequest) ProtoMessage

func (*DeleteBeerRequest) ProtoMessage()

func (*DeleteBeerRequest) ProtoReflect

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

func (*DeleteBeerRequest) Reset

func (x *DeleteBeerRequest) Reset()

func (*DeleteBeerRequest) String

func (x *DeleteBeerRequest) String() string

type GetBeerRequest

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

func (*GetBeerRequest) Descriptor deprecated

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

Deprecated: Use GetBeerRequest.ProtoReflect.Descriptor instead.

func (*GetBeerRequest) GetAsin

func (x *GetBeerRequest) GetAsin() string

func (*GetBeerRequest) ProtoMessage

func (*GetBeerRequest) ProtoMessage()

func (*GetBeerRequest) ProtoReflect

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

func (*GetBeerRequest) Reset

func (x *GetBeerRequest) Reset()

func (*GetBeerRequest) String

func (x *GetBeerRequest) String() string

type GetBeerResponse

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

func (*GetBeerResponse) Descriptor deprecated

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

Deprecated: Use GetBeerResponse.ProtoReflect.Descriptor instead.

func (*GetBeerResponse) GetBeer

func (x *GetBeerResponse) GetBeer() *Beer

func (*GetBeerResponse) ProtoMessage

func (*GetBeerResponse) ProtoMessage()

func (*GetBeerResponse) ProtoReflect

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

func (*GetBeerResponse) Reset

func (x *GetBeerResponse) Reset()

func (*GetBeerResponse) String

func (x *GetBeerResponse) String() string

type GetBeersResponse

type GetBeersResponse struct {
	Beers []*Beer `protobuf:"bytes,1,rep,name=beers,proto3" json:"beers,omitempty"`
	// contains filtered or unexported fields
}

func (*GetBeersResponse) Descriptor deprecated

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

Deprecated: Use GetBeersResponse.ProtoReflect.Descriptor instead.

func (*GetBeersResponse) GetBeers

func (x *GetBeersResponse) GetBeers() []*Beer

func (*GetBeersResponse) ProtoMessage

func (*GetBeersResponse) ProtoMessage()

func (*GetBeersResponse) ProtoReflect

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

func (*GetBeersResponse) Reset

func (x *GetBeersResponse) Reset()

func (*GetBeersResponse) String

func (x *GetBeersResponse) String() string

type UnimplementedBeerServiceServer

type UnimplementedBeerServiceServer struct {
}

UnimplementedBeerServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedBeerServiceServer) AllBeers

func (UnimplementedBeerServiceServer) CreateBeer

func (UnimplementedBeerServiceServer) DeleteBeer

func (UnimplementedBeerServiceServer) GetBeer

func (UnimplementedBeerServiceServer) UpdateBeer

type UnsafeBeerServiceServer

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

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

type UpdateBeerRequest

type UpdateBeerRequest struct {
	Asin string `protobuf:"bytes,1,opt,name=asin,proto3" json:"asin,omitempty"`
	Beer *Beer  `protobuf:"bytes,2,opt,name=beer,proto3" json:"beer,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateBeerRequest) Descriptor deprecated

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

Deprecated: Use UpdateBeerRequest.ProtoReflect.Descriptor instead.

func (*UpdateBeerRequest) GetAsin

func (x *UpdateBeerRequest) GetAsin() string

func (*UpdateBeerRequest) GetBeer

func (x *UpdateBeerRequest) GetBeer() *Beer

func (*UpdateBeerRequest) ProtoMessage

func (*UpdateBeerRequest) ProtoMessage()

func (*UpdateBeerRequest) ProtoReflect

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

func (*UpdateBeerRequest) Reset

func (x *UpdateBeerRequest) Reset()

func (*UpdateBeerRequest) String

func (x *UpdateBeerRequest) String() string

Directories

Path Synopsis
google
api
protoc-gen-openapiv2

Jump to

Keyboard shortcuts

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