Documentation ¶
Overview ¶
Package location is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterLocationServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterLocationServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client LocationServiceClient) error
- func RegisterLocationServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterLocationServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server LocationServiceServer) error
- func RegisterLocationServiceServer(s grpc.ServiceRegistrar, srv LocationServiceServer)
- type CreateLocationRequest
- func (*CreateLocationRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CreateLocationRequest) GetCoordinates() string
- func (x *CreateLocationRequest) GetName() string
- func (*CreateLocationRequest) ProtoMessage()
- func (x *CreateLocationRequest) ProtoReflect() protoreflect.Message
- func (x *CreateLocationRequest) Reset()
- func (x *CreateLocationRequest) String() string
- type CreateLocationResponse
- func (*CreateLocationResponse) Descriptor() ([]byte, []int)deprecated
- func (x *CreateLocationResponse) GetLocationId() int32
- func (*CreateLocationResponse) ProtoMessage()
- func (x *CreateLocationResponse) ProtoReflect() protoreflect.Message
- func (x *CreateLocationResponse) Reset()
- func (x *CreateLocationResponse) String() string
- type Empty
- type GetLocationsResponse
- func (*GetLocationsResponse) Descriptor() ([]byte, []int)deprecated
- func (x *GetLocationsResponse) GetLocations() []*Location
- func (*GetLocationsResponse) ProtoMessage()
- func (x *GetLocationsResponse) ProtoReflect() protoreflect.Message
- func (x *GetLocationsResponse) Reset()
- func (x *GetLocationsResponse) String() string
- type Location
- func (*Location) Descriptor() ([]byte, []int)deprecated
- func (x *Location) GetCoordinates() string
- func (x *Location) GetLocationId() int32
- func (x *Location) GetName() string
- func (*Location) ProtoMessage()
- func (x *Location) ProtoReflect() protoreflect.Message
- func (x *Location) Reset()
- func (x *Location) String() string
- type LocationServiceClient
- type LocationServiceServer
- type UnimplementedLocationServiceServer
- type UnsafeLocationServiceServer
Constants ¶
const ( LocationService_CreateLocation_FullMethodName = "/location.LocationService/CreateLocation" LocationService_GetLocations_FullMethodName = "/location.LocationService/GetLocations" )
Variables ¶
var File_location_proto protoreflect.FileDescriptor
var LocationService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "location.LocationService", HandlerType: (*LocationServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "CreateLocation", Handler: _LocationService_CreateLocation_Handler, }, { MethodName: "GetLocations", Handler: _LocationService_GetLocations_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "location.proto", }
LocationService_ServiceDesc is the grpc.ServiceDesc for LocationService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterLocationServiceHandler ¶
func RegisterLocationServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterLocationServiceHandler registers the http handlers for service LocationService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterLocationServiceHandlerClient ¶
func RegisterLocationServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client LocationServiceClient) error
RegisterLocationServiceHandlerClient registers the http handlers for service LocationService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "LocationServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "LocationServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "LocationServiceClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterLocationServiceHandlerFromEndpoint ¶
func RegisterLocationServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterLocationServiceHandlerFromEndpoint is same as RegisterLocationServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterLocationServiceHandlerServer ¶
func RegisterLocationServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server LocationServiceServer) error
RegisterLocationServiceHandlerServer registers the http handlers for service LocationService to "mux". UnaryRPC :call LocationServiceServer 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 RegisterLocationServiceHandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterLocationServiceServer ¶
func RegisterLocationServiceServer(s grpc.ServiceRegistrar, srv LocationServiceServer)
Types ¶
type CreateLocationRequest ¶
type CreateLocationRequest struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Coordinates string `protobuf:"bytes,2,opt,name=coordinates,proto3" json:"coordinates,omitempty"` // contains filtered or unexported fields }
func (*CreateLocationRequest) Descriptor
deprecated
func (*CreateLocationRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreateLocationRequest.ProtoReflect.Descriptor instead.
func (*CreateLocationRequest) GetCoordinates ¶
func (x *CreateLocationRequest) GetCoordinates() string
func (*CreateLocationRequest) GetName ¶
func (x *CreateLocationRequest) GetName() string
func (*CreateLocationRequest) ProtoMessage ¶
func (*CreateLocationRequest) ProtoMessage()
func (*CreateLocationRequest) ProtoReflect ¶
func (x *CreateLocationRequest) ProtoReflect() protoreflect.Message
func (*CreateLocationRequest) Reset ¶
func (x *CreateLocationRequest) Reset()
func (*CreateLocationRequest) String ¶
func (x *CreateLocationRequest) String() string
type CreateLocationResponse ¶
type CreateLocationResponse struct { LocationId int32 `protobuf:"varint,1,opt,name=locationId,proto3" json:"locationId,omitempty"` // contains filtered or unexported fields }
func (*CreateLocationResponse) Descriptor
deprecated
func (*CreateLocationResponse) Descriptor() ([]byte, []int)
Deprecated: Use CreateLocationResponse.ProtoReflect.Descriptor instead.
func (*CreateLocationResponse) GetLocationId ¶
func (x *CreateLocationResponse) GetLocationId() int32
func (*CreateLocationResponse) ProtoMessage ¶
func (*CreateLocationResponse) ProtoMessage()
func (*CreateLocationResponse) ProtoReflect ¶
func (x *CreateLocationResponse) ProtoReflect() protoreflect.Message
func (*CreateLocationResponse) Reset ¶
func (x *CreateLocationResponse) Reset()
func (*CreateLocationResponse) String ¶
func (x *CreateLocationResponse) String() string
type Empty ¶
type Empty struct {
// contains filtered or unexported fields
}
func (*Empty) Descriptor
deprecated
func (*Empty) ProtoMessage ¶
func (*Empty) ProtoMessage()
func (*Empty) ProtoReflect ¶
func (x *Empty) ProtoReflect() protoreflect.Message
type GetLocationsResponse ¶
type GetLocationsResponse struct { Locations []*Location `protobuf:"bytes,1,rep,name=Locations,proto3" json:"Locations,omitempty"` // contains filtered or unexported fields }
func (*GetLocationsResponse) Descriptor
deprecated
func (*GetLocationsResponse) Descriptor() ([]byte, []int)
Deprecated: Use GetLocationsResponse.ProtoReflect.Descriptor instead.
func (*GetLocationsResponse) GetLocations ¶
func (x *GetLocationsResponse) GetLocations() []*Location
func (*GetLocationsResponse) ProtoMessage ¶
func (*GetLocationsResponse) ProtoMessage()
func (*GetLocationsResponse) ProtoReflect ¶
func (x *GetLocationsResponse) ProtoReflect() protoreflect.Message
func (*GetLocationsResponse) Reset ¶
func (x *GetLocationsResponse) Reset()
func (*GetLocationsResponse) String ¶
func (x *GetLocationsResponse) String() string
type Location ¶
type Location struct { LocationId int32 `protobuf:"varint,1,opt,name=locationId,proto3" json:"locationId,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Coordinates string `protobuf:"bytes,3,opt,name=coordinates,proto3" json:"coordinates,omitempty"` // contains filtered or unexported fields }
func (*Location) Descriptor
deprecated
func (*Location) GetCoordinates ¶
func (*Location) GetLocationId ¶
func (*Location) ProtoMessage ¶
func (*Location) ProtoMessage()
func (*Location) ProtoReflect ¶
func (x *Location) ProtoReflect() protoreflect.Message
type LocationServiceClient ¶
type LocationServiceClient interface { CreateLocation(ctx context.Context, in *CreateLocationRequest, opts ...grpc.CallOption) (*CreateLocationResponse, error) GetLocations(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*GetLocationsResponse, error) }
LocationServiceClient is the client API for LocationService 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 NewLocationServiceClient ¶
func NewLocationServiceClient(cc grpc.ClientConnInterface) LocationServiceClient
type LocationServiceServer ¶
type LocationServiceServer interface { CreateLocation(context.Context, *CreateLocationRequest) (*CreateLocationResponse, error) GetLocations(context.Context, *Empty) (*GetLocationsResponse, error) // contains filtered or unexported methods }
LocationServiceServer is the server API for LocationService service. All implementations must embed UnimplementedLocationServiceServer for forward compatibility.
type UnimplementedLocationServiceServer ¶
type UnimplementedLocationServiceServer struct{}
UnimplementedLocationServiceServer must be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedLocationServiceServer) CreateLocation ¶
func (UnimplementedLocationServiceServer) CreateLocation(context.Context, *CreateLocationRequest) (*CreateLocationResponse, error)
func (UnimplementedLocationServiceServer) GetLocations ¶
func (UnimplementedLocationServiceServer) GetLocations(context.Context, *Empty) (*GetLocationsResponse, error)
type UnsafeLocationServiceServer ¶
type UnsafeLocationServiceServer interface {
// contains filtered or unexported methods
}
UnsafeLocationServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to LocationServiceServer will result in compilation errors.