rename locations to places (#38)

* rename locations to places

* update failing things

Co-authored-by: Janos Dobronszki <dobronszki@gmail.com>
This commit is contained in:
Asim Aslam
2021-01-13 13:08:19 +00:00
committed by GitHub
parent a8e56e5e9e
commit ef2f313e33
15 changed files with 662 additions and 882 deletions

407
places/proto/places.pb.go Normal file
View File

@@ -0,0 +1,407 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: proto/places.proto
package places
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
timestamp "github.com/golang/protobuf/ptypes/timestamp"
wrappers "github.com/golang/protobuf/ptypes/wrappers"
math "math"
)
// 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
type Location struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Metadata map[string]string `protobuf:"bytes,3,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
Timestamp *timestamp.Timestamp `protobuf:"bytes,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
Latitude *wrappers.DoubleValue `protobuf:"bytes,5,opt,name=latitude,proto3" json:"latitude,omitempty"`
Longitude *wrappers.DoubleValue `protobuf:"bytes,6,opt,name=longitude,proto3" json:"longitude,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Location) Reset() { *m = Location{} }
func (m *Location) String() string { return proto.CompactTextString(m) }
func (*Location) ProtoMessage() {}
func (*Location) Descriptor() ([]byte, []int) {
return fileDescriptor_3b635ff9d2e2d652, []int{0}
}
func (m *Location) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Location.Unmarshal(m, b)
}
func (m *Location) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Location.Marshal(b, m, deterministic)
}
func (m *Location) XXX_Merge(src proto.Message) {
xxx_messageInfo_Location.Merge(m, src)
}
func (m *Location) XXX_Size() int {
return xxx_messageInfo_Location.Size(m)
}
func (m *Location) XXX_DiscardUnknown() {
xxx_messageInfo_Location.DiscardUnknown(m)
}
var xxx_messageInfo_Location proto.InternalMessageInfo
func (m *Location) GetId() string {
if m != nil {
return m.Id
}
return ""
}
func (m *Location) GetName() string {
if m != nil {
return m.Name
}
return ""
}
func (m *Location) GetMetadata() map[string]string {
if m != nil {
return m.Metadata
}
return nil
}
func (m *Location) GetTimestamp() *timestamp.Timestamp {
if m != nil {
return m.Timestamp
}
return nil
}
func (m *Location) GetLatitude() *wrappers.DoubleValue {
if m != nil {
return m.Latitude
}
return nil
}
func (m *Location) GetLongitude() *wrappers.DoubleValue {
if m != nil {
return m.Longitude
}
return nil
}
type SaveRequest struct {
Places []*Location `protobuf:"bytes,1,rep,name=places,proto3" json:"places,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *SaveRequest) Reset() { *m = SaveRequest{} }
func (m *SaveRequest) String() string { return proto.CompactTextString(m) }
func (*SaveRequest) ProtoMessage() {}
func (*SaveRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_3b635ff9d2e2d652, []int{1}
}
func (m *SaveRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SaveRequest.Unmarshal(m, b)
}
func (m *SaveRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_SaveRequest.Marshal(b, m, deterministic)
}
func (m *SaveRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_SaveRequest.Merge(m, src)
}
func (m *SaveRequest) XXX_Size() int {
return xxx_messageInfo_SaveRequest.Size(m)
}
func (m *SaveRequest) XXX_DiscardUnknown() {
xxx_messageInfo_SaveRequest.DiscardUnknown(m)
}
var xxx_messageInfo_SaveRequest proto.InternalMessageInfo
func (m *SaveRequest) GetPlaces() []*Location {
if m != nil {
return m.Places
}
return nil
}
type SaveResponse struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *SaveResponse) Reset() { *m = SaveResponse{} }
func (m *SaveResponse) String() string { return proto.CompactTextString(m) }
func (*SaveResponse) ProtoMessage() {}
func (*SaveResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_3b635ff9d2e2d652, []int{2}
}
func (m *SaveResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SaveResponse.Unmarshal(m, b)
}
func (m *SaveResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_SaveResponse.Marshal(b, m, deterministic)
}
func (m *SaveResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_SaveResponse.Merge(m, src)
}
func (m *SaveResponse) XXX_Size() int {
return xxx_messageInfo_SaveResponse.Size(m)
}
func (m *SaveResponse) XXX_DiscardUnknown() {
xxx_messageInfo_SaveResponse.DiscardUnknown(m)
}
var xxx_messageInfo_SaveResponse proto.InternalMessageInfo
type LastRequest struct {
Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *LastRequest) Reset() { *m = LastRequest{} }
func (m *LastRequest) String() string { return proto.CompactTextString(m) }
func (*LastRequest) ProtoMessage() {}
func (*LastRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_3b635ff9d2e2d652, []int{3}
}
func (m *LastRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_LastRequest.Unmarshal(m, b)
}
func (m *LastRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_LastRequest.Marshal(b, m, deterministic)
}
func (m *LastRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_LastRequest.Merge(m, src)
}
func (m *LastRequest) XXX_Size() int {
return xxx_messageInfo_LastRequest.Size(m)
}
func (m *LastRequest) XXX_DiscardUnknown() {
xxx_messageInfo_LastRequest.DiscardUnknown(m)
}
var xxx_messageInfo_LastRequest proto.InternalMessageInfo
func (m *LastRequest) GetIds() []string {
if m != nil {
return m.Ids
}
return nil
}
type ListResponse struct {
Places []*Location `protobuf:"bytes,1,rep,name=places,proto3" json:"places,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ListResponse) Reset() { *m = ListResponse{} }
func (m *ListResponse) String() string { return proto.CompactTextString(m) }
func (*ListResponse) ProtoMessage() {}
func (*ListResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_3b635ff9d2e2d652, []int{4}
}
func (m *ListResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListResponse.Unmarshal(m, b)
}
func (m *ListResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ListResponse.Marshal(b, m, deterministic)
}
func (m *ListResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ListResponse.Merge(m, src)
}
func (m *ListResponse) XXX_Size() int {
return xxx_messageInfo_ListResponse.Size(m)
}
func (m *ListResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ListResponse.DiscardUnknown(m)
}
var xxx_messageInfo_ListResponse proto.InternalMessageInfo
func (m *ListResponse) GetPlaces() []*Location {
if m != nil {
return m.Places
}
return nil
}
type NearRequest struct {
Latitude *wrappers.DoubleValue `protobuf:"bytes,1,opt,name=latitude,proto3" json:"latitude,omitempty"`
Longitude *wrappers.DoubleValue `protobuf:"bytes,2,opt,name=longitude,proto3" json:"longitude,omitempty"`
// radius to search within, units km
Radius *wrappers.DoubleValue `protobuf:"bytes,3,opt,name=radius,proto3" json:"radius,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *NearRequest) Reset() { *m = NearRequest{} }
func (m *NearRequest) String() string { return proto.CompactTextString(m) }
func (*NearRequest) ProtoMessage() {}
func (*NearRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_3b635ff9d2e2d652, []int{5}
}
func (m *NearRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_NearRequest.Unmarshal(m, b)
}
func (m *NearRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_NearRequest.Marshal(b, m, deterministic)
}
func (m *NearRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_NearRequest.Merge(m, src)
}
func (m *NearRequest) XXX_Size() int {
return xxx_messageInfo_NearRequest.Size(m)
}
func (m *NearRequest) XXX_DiscardUnknown() {
xxx_messageInfo_NearRequest.DiscardUnknown(m)
}
var xxx_messageInfo_NearRequest proto.InternalMessageInfo
func (m *NearRequest) GetLatitude() *wrappers.DoubleValue {
if m != nil {
return m.Latitude
}
return nil
}
func (m *NearRequest) GetLongitude() *wrappers.DoubleValue {
if m != nil {
return m.Longitude
}
return nil
}
func (m *NearRequest) GetRadius() *wrappers.DoubleValue {
if m != nil {
return m.Radius
}
return nil
}
type ReadRequest struct {
Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"`
After *timestamp.Timestamp `protobuf:"bytes,2,opt,name=after,proto3" json:"after,omitempty"`
Before *timestamp.Timestamp `protobuf:"bytes,3,opt,name=before,proto3" json:"before,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *ReadRequest) Reset() { *m = ReadRequest{} }
func (m *ReadRequest) String() string { return proto.CompactTextString(m) }
func (*ReadRequest) ProtoMessage() {}
func (*ReadRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_3b635ff9d2e2d652, []int{6}
}
func (m *ReadRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReadRequest.Unmarshal(m, b)
}
func (m *ReadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReadRequest.Marshal(b, m, deterministic)
}
func (m *ReadRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReadRequest.Merge(m, src)
}
func (m *ReadRequest) XXX_Size() int {
return xxx_messageInfo_ReadRequest.Size(m)
}
func (m *ReadRequest) XXX_DiscardUnknown() {
xxx_messageInfo_ReadRequest.DiscardUnknown(m)
}
var xxx_messageInfo_ReadRequest proto.InternalMessageInfo
func (m *ReadRequest) GetIds() []string {
if m != nil {
return m.Ids
}
return nil
}
func (m *ReadRequest) GetAfter() *timestamp.Timestamp {
if m != nil {
return m.After
}
return nil
}
func (m *ReadRequest) GetBefore() *timestamp.Timestamp {
if m != nil {
return m.Before
}
return nil
}
func init() {
proto.RegisterType((*Location)(nil), "places.Location")
proto.RegisterMapType((map[string]string)(nil), "places.Location.MetadataEntry")
proto.RegisterType((*SaveRequest)(nil), "places.SaveRequest")
proto.RegisterType((*SaveResponse)(nil), "places.SaveResponse")
proto.RegisterType((*LastRequest)(nil), "places.LastRequest")
proto.RegisterType((*ListResponse)(nil), "places.ListResponse")
proto.RegisterType((*NearRequest)(nil), "places.NearRequest")
proto.RegisterType((*ReadRequest)(nil), "places.ReadRequest")
}
func init() { proto.RegisterFile("proto/places.proto", fileDescriptor_3b635ff9d2e2d652) }
var fileDescriptor_3b635ff9d2e2d652 = []byte{
// 460 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xcd, 0x6e, 0xd3, 0x40,
0x14, 0x85, 0x19, 0x3b, 0xb1, 0x92, 0xeb, 0x52, 0x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c7, 0x89, 0xd7, 0x30, 0x50,
0xcd, 0xe1, 0x8b, 0x36, 0xf0, 0xde, 0x03, 0x08, 0x2f, 0xee, 0x1f, 0xda, 0x72, 0x9f, 0x29, 0x48,
0xd5, 0xdb, 0x41, 0xbd, 0xb2, 0x3b, 0xa8, 0x5f, 0xb0, 0x81, 0x54, 0x6f, 0x1d, 0xd4, 0x6b, 0xf1,
0x18, 0xa4, 0x02, 0xeb, 0xa0, 0x5e, 0x7c, 0x8f, 0x41, 0x1b, 0x4f, 0x5f, 0xfd, 0xfa, 0x6f, 0x00,
0x00, 0x00, 0xff, 0xff, 0x7a, 0x9f, 0xaf, 0x48, 0x86, 0x04, 0x00, 0x00,
}

View File

@@ -0,0 +1,154 @@
// Code generated by protoc-gen-micro. DO NOT EDIT.
// source: proto/places.proto
package places
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
_ "github.com/golang/protobuf/ptypes/timestamp"
_ "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 Places service
func NewPlacesEndpoints() []*api.Endpoint {
return []*api.Endpoint{}
}
// Client API for Places service
type PlacesService interface {
// Save a set of places
Save(ctx context.Context, in *SaveRequest, opts ...client.CallOption) (*SaveResponse, error)
// Last places for a set of users
Last(ctx context.Context, in *LastRequest, opts ...client.CallOption) (*ListResponse, error)
// Near returns the places near a point at a given time
Near(ctx context.Context, in *NearRequest, opts ...client.CallOption) (*ListResponse, error)
// Read places for a group of users between two points in time
Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ListResponse, error)
}
type placesService struct {
c client.Client
name string
}
func NewPlacesService(name string, c client.Client) PlacesService {
return &placesService{
c: c,
name: name,
}
}
func (c *placesService) Save(ctx context.Context, in *SaveRequest, opts ...client.CallOption) (*SaveResponse, error) {
req := c.c.NewRequest(c.name, "Places.Save", in)
out := new(SaveResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *placesService) Last(ctx context.Context, in *LastRequest, opts ...client.CallOption) (*ListResponse, error) {
req := c.c.NewRequest(c.name, "Places.Last", in)
out := new(ListResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *placesService) Near(ctx context.Context, in *NearRequest, opts ...client.CallOption) (*ListResponse, error) {
req := c.c.NewRequest(c.name, "Places.Near", in)
out := new(ListResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *placesService) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ListResponse, error) {
req := c.c.NewRequest(c.name, "Places.Read", in)
out := new(ListResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for Places service
type PlacesHandler interface {
// Save a set of places
Save(context.Context, *SaveRequest, *SaveResponse) error
// Last places for a set of users
Last(context.Context, *LastRequest, *ListResponse) error
// Near returns the places near a point at a given time
Near(context.Context, *NearRequest, *ListResponse) error
// Read places for a group of users between two points in time
Read(context.Context, *ReadRequest, *ListResponse) error
}
func RegisterPlacesHandler(s server.Server, hdlr PlacesHandler, opts ...server.HandlerOption) error {
type places interface {
Save(ctx context.Context, in *SaveRequest, out *SaveResponse) error
Last(ctx context.Context, in *LastRequest, out *ListResponse) error
Near(ctx context.Context, in *NearRequest, out *ListResponse) error
Read(ctx context.Context, in *ReadRequest, out *ListResponse) error
}
type Places struct {
places
}
h := &placesHandler{hdlr}
return s.Handle(s.NewHandler(&Places{h}, opts...))
}
type placesHandler struct {
PlacesHandler
}
func (h *placesHandler) Save(ctx context.Context, in *SaveRequest, out *SaveResponse) error {
return h.PlacesHandler.Save(ctx, in, out)
}
func (h *placesHandler) Last(ctx context.Context, in *LastRequest, out *ListResponse) error {
return h.PlacesHandler.Last(ctx, in, out)
}
func (h *placesHandler) Near(ctx context.Context, in *NearRequest, out *ListResponse) error {
return h.PlacesHandler.Near(ctx, in, out)
}
func (h *placesHandler) Read(ctx context.Context, in *ReadRequest, out *ListResponse) error {
return h.PlacesHandler.Read(ctx, in, out)
}

53
places/proto/places.proto Normal file
View File

@@ -0,0 +1,53 @@
syntax = "proto3";
package places;
import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";
service Places {
// Save a set of places
rpc Save(SaveRequest) returns (SaveResponse) {}
// Last places for a set of users
rpc Last(LastRequest) returns (ListResponse) {}
// Near returns the places near a point at a given time
rpc Near(NearRequest) returns (ListResponse) {}
// Read places for a group of users between two points in time
rpc Read(ReadRequest) returns (ListResponse) {}
}
message Location {
string id = 1;
string name = 2;
map<string,string> metadata = 3;
google.protobuf.Timestamp timestamp = 4;
google.protobuf.DoubleValue latitude = 5;
google.protobuf.DoubleValue longitude = 6;
}
message SaveRequest {
repeated Location places = 1;
}
message SaveResponse {}
message LastRequest {
repeated string ids = 1;
}
message ListResponse {
repeated Location places = 1;
}
message NearRequest {
google.protobuf.DoubleValue latitude = 1;
google.protobuf.DoubleValue longitude = 2;
// radius to search within, units km
google.protobuf.DoubleValue radius = 3;
}
message ReadRequest {
repeated string ids = 1;
google.protobuf.Timestamp after = 2;
google.protobuf.Timestamp before = 3;
}