Files
services/geocoding/proto/geocoding.pb.micro.go
2021-01-08 14:08:19 +00:00

116 lines
3.3 KiB
Go

// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: proto/geocoding.proto
package geocoding
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
_ "github.com/golang/protobuf/ptypes/wrappers"
math "math"
)
import (
context "context"
api "github.com/micro/micro/v3/service/api"
client "github.com/micro/micro/v3/service/client"
server "github.com/micro/micro/v3/service/server"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
// Reference imports to suppress errors if they are not otherwise used.
var _ api.Endpoint
var _ context.Context
var _ client.Option
var _ server.Option
// Api Endpoints for Geocoding service
func NewGeocodingEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
// Client API for Geocoding service
type GeocodingService interface {
// Geocode an address, the result will be the normalized address which contains coordinates
Geocode(ctx context.Context, in *Address, opts ...client.CallOption) (*Address, error)
// Reverse geocode coordinates to an address
Reverse(ctx context.Context, in *Coordinates, opts ...client.CallOption) (*Address, error)
}
type geocodingService struct {
c client.Client
name string
}
func NewGeocodingService(name string, c client.Client) GeocodingService {
return &geocodingService{
c: c,
name: name,
}
}
func (c *geocodingService) Geocode(ctx context.Context, in *Address, opts ...client.CallOption) (*Address, error) {
req := c.c.NewRequest(c.name, "Geocoding.Geocode", in)
out := new(Address)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *geocodingService) Reverse(ctx context.Context, in *Coordinates, opts ...client.CallOption) (*Address, error) {
req := c.c.NewRequest(c.name, "Geocoding.Reverse", in)
out := new(Address)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Geocoding service
type GeocodingHandler interface {
// Geocode an address, the result will be the normalized address which contains coordinates
Geocode(context.Context, *Address, *Address) error
// Reverse geocode coordinates to an address
Reverse(context.Context, *Coordinates, *Address) error
}
func RegisterGeocodingHandler(s server.Server, hdlr GeocodingHandler, opts ...server.HandlerOption) error {
type geocoding interface {
Geocode(ctx context.Context, in *Address, out *Address) error
Reverse(ctx context.Context, in *Coordinates, out *Address) error
}
type Geocoding struct {
geocoding
}
h := &geocodingHandler{hdlr}
return s.Handle(s.NewHandler(&Geocoding{h}, opts...))
}
type geocodingHandler struct {
GeocodingHandler
}
func (h *geocodingHandler) Geocode(ctx context.Context, in *Address, out *Address) error {
return h.GeocodingHandler.Geocode(ctx, in, out)
}
func (h *geocodingHandler) Reverse(ctx context.Context, in *Coordinates, out *Address) error {
return h.GeocodingHandler.Reverse(ctx, in, out)
}