dogfoodpb

package
v0.0.0-...-db0ecef Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package dogfoodpb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var DogFoodService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "dogfoodpb.v1.DogFoodService",
	HandlerType: (*DogFoodServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateRecord",
			Handler:    _DogFoodService_CreateRecord_Handler,
		},
		{
			MethodName: "ListRecords",
			Handler:    _DogFoodService_ListRecords_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "proto/v1/dogfood/dogfood.proto",
}

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

View Source
var File_proto_v1_dogfood_dogfood_proto protoreflect.FileDescriptor

Functions

func RegisterDogFoodServiceHandler

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

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

func RegisterDogFoodServiceHandlerClient

func RegisterDogFoodServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DogFoodServiceClient) error

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

func RegisterDogFoodServiceHandlerFromEndpoint

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

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

func RegisterDogFoodServiceHandlerServer

func RegisterDogFoodServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DogFoodServiceServer) error

RegisterDogFoodServiceHandlerServer registers the http handlers for service DogFoodService to "mux". UnaryRPC :call DogFoodServiceServer 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 RegisterDogFoodServiceHandlerFromEndpoint instead.

func RegisterDogFoodServiceServer

func RegisterDogFoodServiceServer(s grpc.ServiceRegistrar, srv DogFoodServiceServer)

Types

type CreateRecordRequest

type CreateRecordRequest struct {

	// dog_food name is a name of dogfood brand.
	DogfoodName string `protobuf:"bytes,1,opt,name=dogfood_name,json=dogfoodName,proto3" json:"dogfood_name,omitempty"`
	// grap specifies how grams a dog eat dogfood.
	Gram int32 `protobuf:"varint,2,opt,name=gram,proto3" json:"gram,omitempty"`
	// dog_name specifies a name of dog.
	DogName string `protobuf:"bytes,3,opt,name=dog_name,json=dogName,proto3" json:"dog_name,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateRecordRequest) Descriptor deprecated

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

Deprecated: Use CreateRecordRequest.ProtoReflect.Descriptor instead.

func (*CreateRecordRequest) GetDogName

func (x *CreateRecordRequest) GetDogName() string

func (*CreateRecordRequest) GetDogfoodName

func (x *CreateRecordRequest) GetDogfoodName() string

func (*CreateRecordRequest) GetGram

func (x *CreateRecordRequest) GetGram() int32

func (*CreateRecordRequest) ProtoMessage

func (*CreateRecordRequest) ProtoMessage()

func (*CreateRecordRequest) ProtoReflect

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

func (*CreateRecordRequest) Reset

func (x *CreateRecordRequest) Reset()

func (*CreateRecordRequest) String

func (x *CreateRecordRequest) String() string

type DogFoodServiceClient

type DogFoodServiceClient interface {
	// CreateRecord create a record who ate what, when, and how much.
	CreateRecord(ctx context.Context, in *CreateRecordRequest, opts ...grpc.CallOption) (*Record, error)
	// ListRecords list up all records.
	ListRecords(ctx context.Context, in *ListRecordsRequest, opts ...grpc.CallOption) (*ListRecordsResponse, error)
}

DogFoodServiceClient is the client API for DogFoodService 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 DogFoodServiceServer

type DogFoodServiceServer interface {
	// CreateRecord create a record who ate what, when, and how much.
	CreateRecord(context.Context, *CreateRecordRequest) (*Record, error)
	// ListRecords list up all records.
	ListRecords(context.Context, *ListRecordsRequest) (*ListRecordsResponse, error)
}

DogFoodServiceServer is the server API for DogFoodService service. All implementations should embed UnimplementedDogFoodServiceServer for forward compatibility

type ListRecordsRequest

type ListRecordsRequest struct {

	// from specifies the start time of eaten_at.
	From *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"`
	// page_size specifies a requested length of records.
	PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
	// to specifies the end time of eaten_at.
	To *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=to,proto3" json:"to,omitempty"`
	// contains filtered or unexported fields
}

func (*ListRecordsRequest) Descriptor deprecated

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

Deprecated: Use ListRecordsRequest.ProtoReflect.Descriptor instead.

func (*ListRecordsRequest) GetFrom

func (*ListRecordsRequest) GetPageSize

func (x *ListRecordsRequest) GetPageSize() int32

func (*ListRecordsRequest) GetTo

func (*ListRecordsRequest) ProtoMessage

func (*ListRecordsRequest) ProtoMessage()

func (*ListRecordsRequest) ProtoReflect

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

func (*ListRecordsRequest) Reset

func (x *ListRecordsRequest) Reset()

func (*ListRecordsRequest) String

func (x *ListRecordsRequest) String() string

type ListRecordsResponse

type ListRecordsResponse struct {

	// records specify an array of Record.
	Records []*Record `protobuf:"bytes,1,rep,name=records,proto3" json:"records,omitempty"`
	// to specifies the end time of eaten_at.
	To *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"`
	// contains filtered or unexported fields
}

func (*ListRecordsResponse) Descriptor deprecated

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

Deprecated: Use ListRecordsResponse.ProtoReflect.Descriptor instead.

func (*ListRecordsResponse) GetRecords

func (x *ListRecordsResponse) GetRecords() []*Record

func (*ListRecordsResponse) GetTo

func (*ListRecordsResponse) ProtoMessage

func (*ListRecordsResponse) ProtoMessage()

func (*ListRecordsResponse) ProtoReflect

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

func (*ListRecordsResponse) Reset

func (x *ListRecordsResponse) Reset()

func (*ListRecordsResponse) String

func (x *ListRecordsResponse) String() string

type Record

type Record struct {

	// dog_food name is a name of dogfood brand.
	DogfoodName string `protobuf:"bytes,1,opt,name=dogfood_name,json=dogfoodName,proto3" json:"dogfood_name,omitempty"`
	// grap specifies how grams a dog eat dogfood.
	Gram int32 `protobuf:"varint,2,opt,name=gram,proto3" json:"gram,omitempty"`
	// dog_name specifies a name of dog.
	DogName string `protobuf:"bytes,3,opt,name=dog_name,json=dogName,proto3" json:"dog_name,omitempty"`
	// eaten_at specifies what time a dog ate a dogfood.
	EatenAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=eaten_at,json=eatenAt,proto3" json:"eaten_at,omitempty"`
	// contains filtered or unexported fields
}

func (*Record) Descriptor deprecated

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

Deprecated: Use Record.ProtoReflect.Descriptor instead.

func (*Record) GetDogName

func (x *Record) GetDogName() string

func (*Record) GetDogfoodName

func (x *Record) GetDogfoodName() string

func (*Record) GetEatenAt

func (x *Record) GetEatenAt() *timestamppb.Timestamp

func (*Record) GetGram

func (x *Record) GetGram() int32

func (*Record) ProtoMessage

func (*Record) ProtoMessage()

func (*Record) ProtoReflect

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

func (*Record) Reset

func (x *Record) Reset()

func (*Record) String

func (x *Record) String() string

type UnimplementedDogFoodServiceServer

type UnimplementedDogFoodServiceServer struct {
}

UnimplementedDogFoodServiceServer should be embedded to have forward compatible implementations.

func (UnimplementedDogFoodServiceServer) CreateRecord

func (UnimplementedDogFoodServiceServer) ListRecords

type UnsafeDogFoodServiceServer

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

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

Jump to

Keyboard shortcuts

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