beers

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package beers is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	BeerType_name = map[int32]string{
		0: "BEER_TYPE_UNSPECIFIED",
		1: "BEER_TYPE_ALE",
		2: "BEER_TYPE_BITTER",
		3: "BEER_TYPE_LAGER",
		4: "BEER_TYPE_INDIA_PALE_ALE",
		5: "BEER_TYPE_STOUT",
		6: "BEER_TYPE_PILSNER",
		7: "BEER_TYPE_PORTER",
		8: "BEER_TYPE_PALE_ALE",
	}
	BeerType_value = map[string]int32{
		"BEER_TYPE_UNSPECIFIED":    0,
		"BEER_TYPE_ALE":            1,
		"BEER_TYPE_BITTER":         2,
		"BEER_TYPE_LAGER":          3,
		"BEER_TYPE_INDIA_PALE_ALE": 4,
		"BEER_TYPE_STOUT":          5,
		"BEER_TYPE_PILSNER":        6,
		"BEER_TYPE_PORTER":         7,
		"BEER_TYPE_PALE_ALE":       8,
	}
)

Enum value maps for BeerType.

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.

func RegisterBeerServiceServer

func RegisterBeerServiceServer(s *grpc.Server, srv BeerServiceServer)

Types

type Beer

type Beer struct {
	Id      string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Name    string   `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Type    BeerType `protobuf:"varint,3,opt,name=type,proto3,enum=BeerType" json:"type,omitempty"`
	Brewer  string   `protobuf:"bytes,4,opt,name=brewer,proto3" json:"brewer,omitempty"`
	Country string   `protobuf:"bytes,5,opt,name=country,proto3" json:"country,omitempty"`
	// contains filtered or unexported fields
}

func (*Beer) Descriptor deprecated

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

Deprecated: Use Beer.ProtoReflect.Descriptor instead.

func (*Beer) GetBrewer

func (x *Beer) GetBrewer() string

func (*Beer) GetCountry

func (x *Beer) GetCountry() string

func (*Beer) GetId

func (x *Beer) GetId() string

func (*Beer) GetName

func (x *Beer) GetName() string

func (*Beer) GetType

func (x *Beer) GetType() 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 {
	// CreateBeer creates a beer.
	CreateBeer(ctx context.Context, in *CreateBeerRequest, opts ...grpc.CallOption) (*Beer, error)
	// GetBeer gets a beer given its ID.
	GetBeer(ctx context.Context, in *GetBeerRequest, opts ...grpc.CallOption) (*Beer, error)
	// UpdateBeer updates a beer given its ID.
	UpdateBeer(ctx context.Context, in *UpdateBeerRequest, opts ...grpc.CallOption) (*Beer, error)
	// DeleteBeer deletes a beer given its ID.
	DeleteBeer(ctx context.Context, in *DeleteBeerRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// ListBeers lists beers.
	ListBeers(ctx context.Context, in *ListBeersRequest, opts ...grpc.CallOption) (*ListBeersResponse, error)
}

BeerServiceClient is the client API for BeerService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

type BeerServiceServer

type BeerServiceServer interface {
	// CreateBeer creates a beer.
	CreateBeer(context.Context, *CreateBeerRequest) (*Beer, error)
	// GetBeer gets a beer given its ID.
	GetBeer(context.Context, *GetBeerRequest) (*Beer, error)
	// UpdateBeer updates a beer given its ID.
	UpdateBeer(context.Context, *UpdateBeerRequest) (*Beer, error)
	// DeleteBeer deletes a beer given its ID.
	DeleteBeer(context.Context, *DeleteBeerRequest) (*empty.Empty, error)
	// ListBeers lists beers.
	ListBeers(context.Context, *ListBeersRequest) (*ListBeersResponse, error)
}

BeerServiceServer is the server API for BeerService service.

type BeerType

type BeerType int32
const (
	BeerType_BEER_TYPE_UNSPECIFIED    BeerType = 0
	BeerType_BEER_TYPE_ALE            BeerType = 1
	BeerType_BEER_TYPE_BITTER         BeerType = 2
	BeerType_BEER_TYPE_LAGER          BeerType = 3
	BeerType_BEER_TYPE_INDIA_PALE_ALE BeerType = 4
	BeerType_BEER_TYPE_STOUT          BeerType = 5
	BeerType_BEER_TYPE_PILSNER        BeerType = 6
	BeerType_BEER_TYPE_PORTER         BeerType = 7
	BeerType_BEER_TYPE_PALE_ALE       BeerType = 8
)

func (BeerType) Descriptor

func (BeerType) Descriptor() protoreflect.EnumDescriptor

func (BeerType) Enum

func (x BeerType) Enum() *BeerType

func (BeerType) EnumDescriptor deprecated

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

Deprecated: Use BeerType.Descriptor instead.

func (BeerType) Number

func (x BeerType) Number() protoreflect.EnumNumber

func (BeerType) String

func (x BeerType) String() string

func (BeerType) Type

type CreateBeerRequest

type CreateBeerRequest struct {
	Name    string   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Type    BeerType `protobuf:"varint,2,opt,name=type,proto3,enum=BeerType" json:"type,omitempty"`
	Brewer  string   `protobuf:"bytes,3,opt,name=brewer,proto3" json:"brewer,omitempty"`
	Country string   `protobuf:"bytes,4,opt,name=country,proto3" json:"country,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateBeerRequest) Descriptor deprecated

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

Deprecated: Use CreateBeerRequest.ProtoReflect.Descriptor instead.

func (*CreateBeerRequest) GetBrewer

func (x *CreateBeerRequest) GetBrewer() string

func (*CreateBeerRequest) GetCountry

func (x *CreateBeerRequest) GetCountry() string

func (*CreateBeerRequest) GetName

func (x *CreateBeerRequest) GetName() string

func (*CreateBeerRequest) GetType

func (x *CreateBeerRequest) GetType() BeerType

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 {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteBeerRequest) Descriptor deprecated

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

Deprecated: Use DeleteBeerRequest.ProtoReflect.Descriptor instead.

func (*DeleteBeerRequest) GetId

func (x *DeleteBeerRequest) GetId() 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 Error

type Error struct {
	Code    int32  `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*Error) Descriptor deprecated

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

Deprecated: Use Error.ProtoReflect.Descriptor instead.

func (*Error) GetCode

func (x *Error) GetCode() int32

func (*Error) GetMessage

func (x *Error) GetMessage() string

func (*Error) ProtoMessage

func (*Error) ProtoMessage()

func (*Error) ProtoReflect

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

func (*Error) Reset

func (x *Error) Reset()

func (*Error) String

func (x *Error) String() string

type GetBeerRequest

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

func (*GetBeerRequest) Descriptor deprecated

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

Deprecated: Use GetBeerRequest.ProtoReflect.Descriptor instead.

func (*GetBeerRequest) GetId

func (x *GetBeerRequest) GetId() 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 ListBeersRequest

type ListBeersRequest struct {
	Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
	// contains filtered or unexported fields
}

func (*ListBeersRequest) Descriptor deprecated

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

Deprecated: Use ListBeersRequest.ProtoReflect.Descriptor instead.

func (*ListBeersRequest) GetPage

func (x *ListBeersRequest) GetPage() int32

func (*ListBeersRequest) ProtoMessage

func (*ListBeersRequest) ProtoMessage()

func (*ListBeersRequest) ProtoReflect

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

func (*ListBeersRequest) Reset

func (x *ListBeersRequest) Reset()

func (*ListBeersRequest) String

func (x *ListBeersRequest) String() string

type ListBeersResponse

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

func (*ListBeersResponse) Descriptor deprecated

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

Deprecated: Use ListBeersResponse.ProtoReflect.Descriptor instead.

func (*ListBeersResponse) GetBeers

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

func (*ListBeersResponse) ProtoMessage

func (*ListBeersResponse) ProtoMessage()

func (*ListBeersResponse) ProtoReflect

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

func (*ListBeersResponse) Reset

func (x *ListBeersResponse) Reset()

func (*ListBeersResponse) String

func (x *ListBeersResponse) String() string

type UnimplementedBeerServiceServer

type UnimplementedBeerServiceServer struct {
}

UnimplementedBeerServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedBeerServiceServer) CreateBeer

func (*UnimplementedBeerServiceServer) DeleteBeer

func (*UnimplementedBeerServiceServer) GetBeer

func (*UnimplementedBeerServiceServer) ListBeers

func (*UnimplementedBeerServiceServer) UpdateBeer

type UpdateBeerRequest

type UpdateBeerRequest struct {
	Beer *Beer `protobuf:"bytes,1,opt,name=beer,proto3" json:"beer,omitempty"`
	// Indicates which fields in the provided beer to update. Must be
	// specified and non-empty.
	UpdateMask *field_mask.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateBeerRequest) Descriptor deprecated

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

Deprecated: Use UpdateBeerRequest.ProtoReflect.Descriptor instead.

func (*UpdateBeerRequest) GetBeer

func (x *UpdateBeerRequest) GetBeer() *Beer

func (*UpdateBeerRequest) GetUpdateMask

func (x *UpdateBeerRequest) GetUpdateMask() *field_mask.FieldMask

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

Jump to

Keyboard shortcuts

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