Documentation
¶
Index ¶
- Variables
- func RegisterRouteGuideServer(s grpc.ServiceRegistrar, srv RouteGuideServer)
- type Feature
- type Point
- type RecommendationMode
- func (RecommendationMode) Descriptor() protoreflect.EnumDescriptor
- func (x RecommendationMode) Enum() *RecommendationMode
- func (RecommendationMode) EnumDescriptor() ([]byte, []int)deprecated
- func (x RecommendationMode) Number() protoreflect.EnumNumber
- func (x RecommendationMode) String() string
- func (RecommendationMode) Type() protoreflect.EnumType
- type RecommendationRequest
- func (*RecommendationRequest) Descriptor() ([]byte, []int)deprecated
- func (x *RecommendationRequest) GetMode() RecommendationMode
- func (x *RecommendationRequest) GetPoint() *Point
- func (*RecommendationRequest) ProtoMessage()
- func (x *RecommendationRequest) ProtoReflect() protoreflect.Message
- func (x *RecommendationRequest) Reset()
- func (x *RecommendationRequest) String() string
- type Rectangle
- type RouteGuideClient
- type RouteGuideServer
- type RouteGuide_ListFeaturesClient
- type RouteGuide_ListFeaturesServer
- type RouteGuide_RecommendClient
- type RouteGuide_RecommendServer
- type RouteGuide_RecordRouteClient
- type RouteGuide_RecordRouteServer
- type RouteSummary
- func (*RouteSummary) Descriptor() ([]byte, []int)deprecated
- func (x *RouteSummary) GetDistance() int32
- func (x *RouteSummary) GetElapsedTime() int32
- func (x *RouteSummary) GetPointCount() int32
- func (*RouteSummary) ProtoMessage()
- func (x *RouteSummary) ProtoReflect() protoreflect.Message
- func (x *RouteSummary) Reset()
- func (x *RouteSummary) String() string
- type UnimplementedRouteGuideServer
- func (UnimplementedRouteGuideServer) GetFeatures(context.Context, *Point) (*Feature, error)
- func (UnimplementedRouteGuideServer) ListFeatures(*Rectangle, RouteGuide_ListFeaturesServer) error
- func (UnimplementedRouteGuideServer) Recommend(RouteGuide_RecommendServer) error
- func (UnimplementedRouteGuideServer) RecordRoute(RouteGuide_RecordRouteServer) error
- type UnsafeRouteGuideServer
Constants ¶
This section is empty.
Variables ¶
var ( RecommendationMode_name = map[int32]string{ 0: "GetFarthest", 1: "GetNearest", } RecommendationMode_value = map[string]int32{ "GetFarthest": 0, "GetNearest": 1, } )
Enum value maps for RecommendationMode.
var File_route_proto protoreflect.FileDescriptor
var RouteGuide_ServiceDesc = grpc.ServiceDesc{ ServiceName: "protocol.RouteGuide", HandlerType: (*RouteGuideServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetFeatures", Handler: _RouteGuide_GetFeatures_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "ListFeatures", Handler: _RouteGuide_ListFeatures_Handler, ServerStreams: true, }, { StreamName: "RecordRoute", Handler: _RouteGuide_RecordRoute_Handler, ClientStreams: true, }, { StreamName: "Recommend", Handler: _RouteGuide_Recommend_Handler, ServerStreams: true, ClientStreams: true, }, }, Metadata: "route.proto", }
RouteGuide_ServiceDesc is the grpc.ServiceDesc for RouteGuide service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterRouteGuideServer ¶
func RegisterRouteGuideServer(s grpc.ServiceRegistrar, srv RouteGuideServer)
Types ¶
type Feature ¶
type Feature struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Location *Point `protobuf:"bytes,2,opt,name=location,proto3" json:"location,omitempty"`
// contains filtered or unexported fields
}
func (*Feature) Descriptor
deprecated
func (*Feature) GetLocation ¶
func (*Feature) ProtoMessage ¶
func (*Feature) ProtoMessage()
func (*Feature) ProtoReflect ¶
func (x *Feature) ProtoReflect() protoreflect.Message
type Point ¶
type Point struct {
Latitude int32 `protobuf:"varint,1,opt,name=latitude,proto3" json:"latitude,omitempty"` // 纬度
Longitude int32 `protobuf:"varint,2,opt,name=longitude,proto3" json:"longitude,omitempty"` // 经度
// contains filtered or unexported fields
}
func (*Point) Descriptor
deprecated
func (*Point) GetLatitude ¶
func (*Point) GetLongitude ¶
func (*Point) ProtoMessage ¶
func (*Point) ProtoMessage()
func (*Point) ProtoReflect ¶
func (x *Point) ProtoReflect() protoreflect.Message
type RecommendationMode ¶
type RecommendationMode int32
const ( RecommendationMode_GetFarthest RecommendationMode = 0 RecommendationMode_GetNearest RecommendationMode = 1 )
func (RecommendationMode) Descriptor ¶
func (RecommendationMode) Descriptor() protoreflect.EnumDescriptor
func (RecommendationMode) Enum ¶
func (x RecommendationMode) Enum() *RecommendationMode
func (RecommendationMode) EnumDescriptor
deprecated
func (RecommendationMode) EnumDescriptor() ([]byte, []int)
Deprecated: Use RecommendationMode.Descriptor instead.
func (RecommendationMode) Number ¶
func (x RecommendationMode) Number() protoreflect.EnumNumber
func (RecommendationMode) String ¶
func (x RecommendationMode) String() string
func (RecommendationMode) Type ¶
func (RecommendationMode) Type() protoreflect.EnumType
type RecommendationRequest ¶
type RecommendationRequest struct {
Mode RecommendationMode `protobuf:"varint,1,opt,name=mode,proto3,enum=protocol.RecommendationMode" json:"mode,omitempty"` // 推荐模式
Point *Point `protobuf:"bytes,2,opt,name=point,proto3" json:"point,omitempty"` // 点
// contains filtered or unexported fields
}
func (*RecommendationRequest) Descriptor
deprecated
func (*RecommendationRequest) Descriptor() ([]byte, []int)
Deprecated: Use RecommendationRequest.ProtoReflect.Descriptor instead.
func (*RecommendationRequest) GetMode ¶
func (x *RecommendationRequest) GetMode() RecommendationMode
func (*RecommendationRequest) GetPoint ¶
func (x *RecommendationRequest) GetPoint() *Point
func (*RecommendationRequest) ProtoMessage ¶
func (*RecommendationRequest) ProtoMessage()
func (*RecommendationRequest) ProtoReflect ¶
func (x *RecommendationRequest) ProtoReflect() protoreflect.Message
func (*RecommendationRequest) Reset ¶
func (x *RecommendationRequest) Reset()
func (*RecommendationRequest) String ¶
func (x *RecommendationRequest) String() string
type Rectangle ¶
type Rectangle struct {
Lo *Point `protobuf:"bytes,1,opt,name=lo,proto3" json:"lo,omitempty"`
Hi *Point `protobuf:"bytes,2,opt,name=hi,proto3" json:"hi,omitempty"`
// contains filtered or unexported fields
}
func (*Rectangle) Descriptor
deprecated
func (*Rectangle) ProtoMessage ¶
func (*Rectangle) ProtoMessage()
func (*Rectangle) ProtoReflect ¶
func (x *Rectangle) ProtoReflect() protoreflect.Message
type RouteGuideClient ¶
type RouteGuideClient interface {
// unary
GetFeatures(ctx context.Context, in *Point, opts ...grpc.CallOption) (*Feature, error)
// server side streaming
ListFeatures(ctx context.Context, in *Rectangle, opts ...grpc.CallOption) (RouteGuide_ListFeaturesClient, error)
// client side streaming
RecordRoute(ctx context.Context, opts ...grpc.CallOption) (RouteGuide_RecordRouteClient, error)
// bidirectional streaming
Recommend(ctx context.Context, opts ...grpc.CallOption) (RouteGuide_RecommendClient, error)
}
RouteGuideClient is the client API for RouteGuide 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 NewRouteGuideClient ¶
func NewRouteGuideClient(cc grpc.ClientConnInterface) RouteGuideClient
type RouteGuideServer ¶
type RouteGuideServer interface {
// unary
GetFeatures(context.Context, *Point) (*Feature, error)
// server side streaming
ListFeatures(*Rectangle, RouteGuide_ListFeaturesServer) error
// client side streaming
RecordRoute(RouteGuide_RecordRouteServer) error
// bidirectional streaming
Recommend(RouteGuide_RecommendServer) error
// contains filtered or unexported methods
}
RouteGuideServer is the server API for RouteGuide service. All implementations must embed UnimplementedRouteGuideServer for forward compatibility
type RouteGuide_ListFeaturesClient ¶
type RouteGuide_ListFeaturesClient interface {
Recv() (*Feature, error)
grpc.ClientStream
}
type RouteGuide_ListFeaturesServer ¶
type RouteGuide_ListFeaturesServer interface {
Send(*Feature) error
grpc.ServerStream
}
type RouteGuide_RecommendClient ¶
type RouteGuide_RecommendClient interface {
Send(*RecommendationRequest) error
Recv() (*Feature, error)
grpc.ClientStream
}
type RouteGuide_RecommendServer ¶
type RouteGuide_RecommendServer interface {
Send(*Feature) error
Recv() (*RecommendationRequest, error)
grpc.ServerStream
}
type RouteGuide_RecordRouteClient ¶
type RouteGuide_RecordRouteClient interface {
Send(*Point) error
CloseAndRecv() (*RouteSummary, error)
grpc.ClientStream
}
type RouteGuide_RecordRouteServer ¶
type RouteGuide_RecordRouteServer interface {
SendAndClose(*RouteSummary) error
Recv() (*Point, error)
grpc.ServerStream
}
type RouteSummary ¶
type RouteSummary struct {
PointCount int32 `protobuf:"varint,1,opt,name=point_count,json=pointCount,proto3" json:"point_count,omitempty"`
Distance int32 `protobuf:"varint,2,opt,name=distance,proto3" json:"distance,omitempty"` // 距离
ElapsedTime int32 `protobuf:"varint,3,opt,name=elapsed_time,json=elapsedTime,proto3" json:"elapsed_time,omitempty"`
// contains filtered or unexported fields
}
func (*RouteSummary) Descriptor
deprecated
func (*RouteSummary) Descriptor() ([]byte, []int)
Deprecated: Use RouteSummary.ProtoReflect.Descriptor instead.
func (*RouteSummary) GetDistance ¶
func (x *RouteSummary) GetDistance() int32
func (*RouteSummary) GetElapsedTime ¶
func (x *RouteSummary) GetElapsedTime() int32
func (*RouteSummary) GetPointCount ¶
func (x *RouteSummary) GetPointCount() int32
func (*RouteSummary) ProtoMessage ¶
func (*RouteSummary) ProtoMessage()
func (*RouteSummary) ProtoReflect ¶
func (x *RouteSummary) ProtoReflect() protoreflect.Message
func (*RouteSummary) Reset ¶
func (x *RouteSummary) Reset()
func (*RouteSummary) String ¶
func (x *RouteSummary) String() string
type UnimplementedRouteGuideServer ¶
type UnimplementedRouteGuideServer struct {
}
UnimplementedRouteGuideServer must be embedded to have forward compatible implementations.
func (UnimplementedRouteGuideServer) GetFeatures ¶
func (UnimplementedRouteGuideServer) ListFeatures ¶
func (UnimplementedRouteGuideServer) ListFeatures(*Rectangle, RouteGuide_ListFeaturesServer) error
func (UnimplementedRouteGuideServer) Recommend ¶
func (UnimplementedRouteGuideServer) Recommend(RouteGuide_RecommendServer) error
func (UnimplementedRouteGuideServer) RecordRoute ¶
func (UnimplementedRouteGuideServer) RecordRoute(RouteGuide_RecordRouteServer) error
type UnsafeRouteGuideServer ¶
type UnsafeRouteGuideServer interface {
// contains filtered or unexported methods
}
UnsafeRouteGuideServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to RouteGuideServer will result in compilation errors.