Documentation
¶
Overview ¶
Package nutrition is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterNutritionServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterNutritionServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client NutritionServiceClient) error
- func RegisterNutritionServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterNutritionServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server NutritionServiceServer) error
- func RegisterNutritionServiceServer(s grpc.ServiceRegistrar, srv NutritionServiceServer)
- type CreateItemRequest
- func (*CreateItemRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CreateItemRequest) GetCalories() float32
- func (x *CreateItemRequest) GetCarbs() float32
- func (x *CreateItemRequest) GetCompany() string
- func (x *CreateItemRequest) GetFat() float32
- func (x *CreateItemRequest) GetName() string
- func (x *CreateItemRequest) GetPortionSize() int32
- func (x *CreateItemRequest) GetPrice() float32
- func (x *CreateItemRequest) GetProtein() float32
- func (*CreateItemRequest) ProtoMessage()
- func (x *CreateItemRequest) ProtoReflect() protoreflect.Message
- func (x *CreateItemRequest) Reset()
- func (x *CreateItemRequest) String() string
- type CreateItemResponse
- type Item
- func (*Item) Descriptor() ([]byte, []int)deprecated
- func (x *Item) GetCalories() float32
- func (x *Item) GetCarbs() float32
- func (x *Item) GetCompany() string
- func (x *Item) GetFat() float32
- func (x *Item) GetName() string
- func (x *Item) GetPortionSize() float32
- func (x *Item) GetPrice() int32
- func (x *Item) GetProtein() float32
- func (*Item) ProtoMessage()
- func (x *Item) ProtoReflect() protoreflect.Message
- func (x *Item) Reset()
- func (x *Item) String() string
- type NutritionServiceClient
- type NutritionServiceServer
- type UnimplementedNutritionServiceServer
- type UnsafeNutritionServiceServer
Constants ¶
const (
NutritionService_CreateItem_FullMethodName = "/gen.nutrition.NutritionService/CreateItem"
)
Variables ¶
var File_nutrition_item_proto protoreflect.FileDescriptor
var File_nutrition_rpc_create_item_proto protoreflect.FileDescriptor
var File_nutrition_service_proto protoreflect.FileDescriptor
var NutritionService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "gen.nutrition.NutritionService", HandlerType: (*NutritionServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "CreateItem", Handler: _NutritionService_CreateItem_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "nutrition/service.proto", }
NutritionService_ServiceDesc is the grpc.ServiceDesc for NutritionService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterNutritionServiceHandler ¶ added in v1.12.0
func RegisterNutritionServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterNutritionServiceHandler registers the http handlers for service NutritionService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterNutritionServiceHandlerClient ¶ added in v1.12.0
func RegisterNutritionServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client NutritionServiceClient) error
RegisterNutritionServiceHandlerClient registers the http handlers for service NutritionService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "NutritionServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "NutritionServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "NutritionServiceClient" to call the correct interceptors.
func RegisterNutritionServiceHandlerFromEndpoint ¶ added in v1.12.0
func RegisterNutritionServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterNutritionServiceHandlerFromEndpoint is same as RegisterNutritionServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterNutritionServiceHandlerServer ¶ added in v1.12.0
func RegisterNutritionServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server NutritionServiceServer) error
RegisterNutritionServiceHandlerServer registers the http handlers for service NutritionService to "mux". UnaryRPC :call NutritionServiceServer 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 RegisterNutritionServiceHandlerFromEndpoint instead.
func RegisterNutritionServiceServer ¶
func RegisterNutritionServiceServer(s grpc.ServiceRegistrar, srv NutritionServiceServer)
Types ¶
type CreateItemRequest ¶
type CreateItemRequest struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Price float32 `protobuf:"fixed32,2,opt,name=price,proto3" json:"price,omitempty"` Company string `protobuf:"bytes,3,opt,name=company,proto3" json:"company,omitempty"` PortionSize int32 `protobuf:"varint,4,opt,name=portion_size,json=portionSize,proto3" json:"portion_size,omitempty"` Calories float32 `protobuf:"fixed32,5,opt,name=calories,proto3" json:"calories,omitempty"` Protein float32 `protobuf:"fixed32,6,opt,name=protein,proto3" json:"protein,omitempty"` Carbs float32 `protobuf:"fixed32,7,opt,name=carbs,proto3" json:"carbs,omitempty"` Fat float32 `protobuf:"fixed32,8,opt,name=fat,proto3" json:"fat,omitempty"` // contains filtered or unexported fields }
func (*CreateItemRequest) Descriptor
deprecated
func (*CreateItemRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreateItemRequest.ProtoReflect.Descriptor instead.
func (*CreateItemRequest) GetCalories ¶
func (x *CreateItemRequest) GetCalories() float32
func (*CreateItemRequest) GetCarbs ¶
func (x *CreateItemRequest) GetCarbs() float32
func (*CreateItemRequest) GetCompany ¶
func (x *CreateItemRequest) GetCompany() string
func (*CreateItemRequest) GetFat ¶
func (x *CreateItemRequest) GetFat() float32
func (*CreateItemRequest) GetName ¶
func (x *CreateItemRequest) GetName() string
func (*CreateItemRequest) GetPortionSize ¶
func (x *CreateItemRequest) GetPortionSize() int32
func (*CreateItemRequest) GetPrice ¶
func (x *CreateItemRequest) GetPrice() float32
func (*CreateItemRequest) GetProtein ¶
func (x *CreateItemRequest) GetProtein() float32
func (*CreateItemRequest) ProtoMessage ¶
func (*CreateItemRequest) ProtoMessage()
func (*CreateItemRequest) ProtoReflect ¶
func (x *CreateItemRequest) ProtoReflect() protoreflect.Message
func (*CreateItemRequest) Reset ¶
func (x *CreateItemRequest) Reset()
func (*CreateItemRequest) String ¶
func (x *CreateItemRequest) String() string
type CreateItemResponse ¶
type CreateItemResponse struct { Item *Item `protobuf:"bytes,1,opt,name=item,proto3" json:"item,omitempty"` // contains filtered or unexported fields }
func (*CreateItemResponse) Descriptor
deprecated
func (*CreateItemResponse) Descriptor() ([]byte, []int)
Deprecated: Use CreateItemResponse.ProtoReflect.Descriptor instead.
func (*CreateItemResponse) GetItem ¶
func (x *CreateItemResponse) GetItem() *Item
func (*CreateItemResponse) ProtoMessage ¶
func (*CreateItemResponse) ProtoMessage()
func (*CreateItemResponse) ProtoReflect ¶
func (x *CreateItemResponse) ProtoReflect() protoreflect.Message
func (*CreateItemResponse) Reset ¶
func (x *CreateItemResponse) Reset()
func (*CreateItemResponse) String ¶
func (x *CreateItemResponse) String() string
type Item ¶
type Item struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Price int32 `protobuf:"varint,2,opt,name=price,proto3" json:"price,omitempty"` Company string `protobuf:"bytes,3,opt,name=company,proto3" json:"company,omitempty"` PortionSize float32 `protobuf:"fixed32,4,opt,name=portion_size,json=portionSize,proto3" json:"portion_size,omitempty"` Calories float32 `protobuf:"fixed32,5,opt,name=calories,proto3" json:"calories,omitempty"` Protein float32 `protobuf:"fixed32,6,opt,name=protein,proto3" json:"protein,omitempty"` Carbs float32 `protobuf:"fixed32,7,opt,name=carbs,proto3" json:"carbs,omitempty"` Fat float32 `protobuf:"fixed32,8,opt,name=fat,proto3" json:"fat,omitempty"` // contains filtered or unexported fields }
func (*Item) Descriptor
deprecated
func (*Item) GetCalories ¶
func (*Item) GetCompany ¶
func (*Item) GetPortionSize ¶
func (*Item) GetProtein ¶
func (*Item) ProtoMessage ¶
func (*Item) ProtoMessage()
func (*Item) ProtoReflect ¶
func (x *Item) ProtoReflect() protoreflect.Message
type NutritionServiceClient ¶
type NutritionServiceClient interface {
CreateItem(ctx context.Context, in *CreateItemRequest, opts ...grpc.CallOption) (*CreateItemResponse, error)
}
NutritionServiceClient is the client API for NutritionService 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 NewNutritionServiceClient ¶
func NewNutritionServiceClient(cc grpc.ClientConnInterface) NutritionServiceClient
type NutritionServiceServer ¶
type NutritionServiceServer interface { CreateItem(context.Context, *CreateItemRequest) (*CreateItemResponse, error) // contains filtered or unexported methods }
NutritionServiceServer is the server API for NutritionService service. All implementations must embed UnimplementedNutritionServiceServer for forward compatibility
type UnimplementedNutritionServiceServer ¶
type UnimplementedNutritionServiceServer struct { }
UnimplementedNutritionServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedNutritionServiceServer) CreateItem ¶
func (UnimplementedNutritionServiceServer) CreateItem(context.Context, *CreateItemRequest) (*CreateItemResponse, error)
type UnsafeNutritionServiceServer ¶
type UnsafeNutritionServiceServer interface {
// contains filtered or unexported methods
}
UnsafeNutritionServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to NutritionServiceServer will result in compilation errors.