location

package
v0.0.0-...-1f1c62d Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package location is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	LocationService_CreateLocation_FullMethodName = "/location.LocationService/CreateLocation"
	LocationService_GetLocations_FullMethodName   = "/location.LocationService/GetLocations"
)

Variables

View Source
var File_location_proto protoreflect.FileDescriptor
View Source
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) Descriptor() ([]byte, []int)

Deprecated: Use Empty.ProtoReflect.Descriptor instead.

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) ProtoReflect

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

func (*Empty) Reset

func (x *Empty) Reset()

func (*Empty) String

func (x *Empty) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use Location.ProtoReflect.Descriptor instead.

func (*Location) GetCoordinates

func (x *Location) GetCoordinates() string

func (*Location) GetLocationId

func (x *Location) GetLocationId() int32

func (*Location) GetName

func (x *Location) GetName() string

func (*Location) ProtoMessage

func (*Location) ProtoMessage()

func (*Location) ProtoReflect

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

func (*Location) Reset

func (x *Location) Reset()

func (*Location) String

func (x *Location) String() string

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.

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) GetLocations

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.

Jump to

Keyboard shortcuts

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