mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-11 19:04:35 +00:00
Locations Service (#34)
* Locations Proto * Add Read RPC * Locations Service * Add read locks
This commit is contained in:
4
go.mod
4
go.mod
@@ -11,6 +11,7 @@ require (
|
||||
github.com/micro/dev v0.0.0-20201117163752-d3cfc9788dfa
|
||||
github.com/micro/micro/v3 v3.0.5-0.20201219085254-c8ea24387d19
|
||||
github.com/miekg/dns v1.1.31 // indirect
|
||||
github.com/stretchr/testify v1.6.1
|
||||
github.com/ulikunitz/xz v0.5.8 // indirect
|
||||
golang.org/x/crypto v0.0.0-20201002094018-c90954cbb977
|
||||
golang.org/x/net v0.0.0-20200930145003-4acb6c075d10
|
||||
@@ -18,7 +19,10 @@ require (
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f // indirect
|
||||
google.golang.org/genproto v0.0.0-20201001141541-efaab9d3c4f7 // indirect
|
||||
google.golang.org/grpc v1.32.0 // indirect
|
||||
google.golang.org/protobuf v1.25.0
|
||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect
|
||||
gorm.io/driver/postgres v1.0.6
|
||||
gorm.io/gorm v1.20.9
|
||||
)
|
||||
|
||||
replace google.golang.org/grpc => google.golang.org/grpc v1.26.0
|
||||
|
||||
99
go.sum
99
go.sum
@@ -80,10 +80,14 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
github.com/cloudflare/cloudflare-go v0.10.2/go.mod h1:qhVI5MKwBGhdNU89ZRz2plgYutcJ5PCekLxXn56w6SY=
|
||||
github.com/cloudflare/cloudflare-go v0.10.9/go.mod h1:5TrsWH+3f4NV6WjtS5QFp+DifH81rph40gU374Sh0dQ=
|
||||
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
|
||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/cpu/goacmedns v0.0.1/go.mod h1:sesf/pNnCYwUevQEQfEwY0Y3DydlQWSGZbaMElOWxok=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
@@ -216,7 +220,54 @@ github.com/improbable-eng/grpc-web v0.13.0 h1:7XqtaBWaOCH0cVGKHyvhtcuo6fgW32Y10y
|
||||
github.com/improbable-eng/grpc-web v0.13.0/go.mod h1:6hRR09jOEG81ADP5wCQju1z71g6OL4eEvELdran/3cs=
|
||||
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf h1:WfD7VjIE6z8dIvMsI4/s+1qr5EL+zoIGev1BQj1eoJ8=
|
||||
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf/go.mod h1:hyb9oH7vZsitZCiBt0ZvifOrB+qc8PS5IiilCIb87rg=
|
||||
github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=
|
||||
github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
|
||||
github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
|
||||
github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA=
|
||||
github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE=
|
||||
github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s=
|
||||
github.com/jackc/pgconn v1.4.0/go.mod h1:Y2O3ZDF0q4mMacyWV3AstPJpeHXWGEetiFttmq5lahk=
|
||||
github.com/jackc/pgconn v1.5.0/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI=
|
||||
github.com/jackc/pgconn v1.5.1-0.20200601181101-fa742c524853/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI=
|
||||
github.com/jackc/pgconn v1.8.0 h1:FmjZ0rOyXTr1wfWs45i4a9vjnjWUAGpMuQLD9OSs+lw=
|
||||
github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o=
|
||||
github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8=
|
||||
github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE=
|
||||
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
|
||||
github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78=
|
||||
github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA=
|
||||
github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg=
|
||||
github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM=
|
||||
github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM=
|
||||
github.com/jackc/pgproto3/v2 v2.0.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
|
||||
github.com/jackc/pgproto3/v2 v2.0.6 h1:b1105ZGEMFe7aCvrT1Cca3VoVb4ZFMaFJLJcg/3zD+8=
|
||||
github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
|
||||
github.com/jackc/pgservicefile v0.0.0-20200307190119-3430c5407db8/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E=
|
||||
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E=
|
||||
github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg=
|
||||
github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc=
|
||||
github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw=
|
||||
github.com/jackc/pgtype v1.2.0/go.mod h1:5m2OfMh1wTK7x+Fk952IDmI4nw3nPrvtQdM0ZT4WpC0=
|
||||
github.com/jackc/pgtype v1.3.1-0.20200510190516-8cd94a14c75a/go.mod h1:vaogEUkALtxZMCH411K+tKzNpwzCKU+AnPzBKZ+I+Po=
|
||||
github.com/jackc/pgtype v1.3.1-0.20200606141011-f6355165a91c/go.mod h1:cvk9Bgu/VzJ9/lxTO5R5sf80p0DiucVtN7ZxvaC4GmQ=
|
||||
github.com/jackc/pgtype v1.6.2 h1:b3pDeuhbbzBYcg5kwNmNDun4pFUD/0AAr1kLXZLeNt8=
|
||||
github.com/jackc/pgtype v1.6.2/go.mod h1:JCULISAZBFGrHaOXIIFiyfzW5VY0GRitRr8NeJsrdig=
|
||||
github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y=
|
||||
github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM=
|
||||
github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc=
|
||||
github.com/jackc/pgx/v4 v4.5.0/go.mod h1:EpAKPLdnTorwmPUUsqrPxy5fphV18j9q3wrfRXgo+kA=
|
||||
github.com/jackc/pgx/v4 v4.6.1-0.20200510190926-94ba730bb1e9/go.mod h1:t3/cdRQl6fOLDxqtlyhe9UWgfIi9R8+8v8GKV5TRA/o=
|
||||
github.com/jackc/pgx/v4 v4.6.1-0.20200606145419-4e5062306904/go.mod h1:ZDaNWkt9sW1JMiNn0kdYBaLelIhw7Pg4qd+Vk6tw7Hg=
|
||||
github.com/jackc/pgx/v4 v4.10.1 h1:/6Q3ye4myIj6AaplUm+eRcz4OhK9HAvFf4ePsG40LJY=
|
||||
github.com/jackc/pgx/v4 v4.10.1/go.mod h1:QlrWebbs3kqEZPHCTGyxecvzG6tvIsYu+A5b1raylkA=
|
||||
github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
|
||||
github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
|
||||
github.com/jackc/puddle v1.1.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
|
||||
github.com/jackc/puddle v1.1.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
|
||||
github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
|
||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||
github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
|
||||
github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
@@ -239,14 +290,27 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
|
||||
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
|
||||
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/labbsr0x/bindman-dns-webhook v1.0.2/go.mod h1:p6b+VCXIR8NYKpDr8/dg1HKfQoRHCdcsROXKvmoehKA=
|
||||
github.com/labbsr0x/goh v1.0.1/go.mod h1:8K2UhVoaWXcCU7Lxoa2omWnC8gyW8px7/lmO61c027w=
|
||||
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/linode/linodego v0.10.0/go.mod h1:cziNP7pbvE3mXIPneHj0oRY8L1WtGEIKlZ8LANE4eXA=
|
||||
github.com/liquidweb/liquidweb-go v1.6.0/go.mod h1:UDcVnAMDkZxpw4Y7NOHkqoeiGacVLEIG/i5J9cyixzQ=
|
||||
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
|
||||
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
@@ -333,20 +397,26 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
|
||||
github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik=
|
||||
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
|
||||
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
|
||||
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
|
||||
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
|
||||
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/sacloud/libsacloud v1.26.1/go.mod h1:79ZwATmHLIFZIMd7sxA3LwzVy/B77uj3LDoToVTxDoQ=
|
||||
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
||||
github.com/serenize/snaker v0.0.0-20171204205717-a683aaf2d516/go.mod h1:Yow6lPLSAXx2ifx470yD/nUe22Dv5vBvxK/UK9UUTVs=
|
||||
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
|
||||
github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/skratchdot/open-golang v0.0.0-20160302144031-75fb7ed4208c/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
@@ -376,6 +446,7 @@ github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca/go.mod h1:ce1O1j6Ut
|
||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
|
||||
go.etcd.io/bbolt v1.3.5 h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0=
|
||||
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
|
||||
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
@@ -386,16 +457,27 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
|
||||
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
|
||||
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
|
||||
go.uber.org/ratelimit v0.0.0-20180316092928-c15da0234277/go.mod h1:2X8KaoNd1J0lZV+PxJk/5+DGbO/tpwLR1m++a7FnB/Y=
|
||||
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
|
||||
go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
golang.org/x/crypto v0.0.0-20180621125126-a49355c7e3f8/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
|
||||
golang.org/x/crypto v0.0.0-20190418165655-df01cb2cc480/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
|
||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20201002094018-c90954cbb977 h1:yH6opeNE+0SY+7pXT4gclZUoKHogXeC2EvOSHGOMGPU=
|
||||
@@ -448,6 +530,7 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190930134127-c5a3c61f89f3/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191027093000-83d349e8ac1a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
@@ -493,6 +576,7 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5h
|
||||
golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@@ -503,6 +587,8 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@@ -510,6 +596,7 @@ golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@@ -542,14 +629,18 @@ golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3
|
||||
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
@@ -576,6 +667,8 @@ golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roY
|
||||
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
@@ -659,6 +752,7 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/h2non/gock.v1 v1.0.15/go.mod h1:sX4zAkdYX1TRGJ2JY156cFspQn4yRWn6p9EMdODlynE=
|
||||
gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s=
|
||||
gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/ini.v1 v1.44.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/ini.v1 v1.57.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
@@ -679,6 +773,11 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gorm.io/driver/postgres v1.0.6 h1:9sqNcNC9PCkZ6tMzWF1cEE2PARlCONgSqRobszSTffw=
|
||||
gorm.io/driver/postgres v1.0.6/go.mod h1:r0nvX27yHDNbVeXMM9Y+9i5xSePcT18RfH8clP6wpwI=
|
||||
gorm.io/gorm v1.20.8/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
|
||||
gorm.io/gorm v1.20.9 h1:M3aIZKXAC1PtPVu9t3WGwkBTE1le5c2telz3I/qjRNg=
|
||||
gorm.io/gorm v1.20.9/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
|
||||
1
locations/.gitignore
vendored
Normal file
1
locations/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
locations
|
||||
18
locations/Makefile
Normal file
18
locations/Makefile
Normal file
@@ -0,0 +1,18 @@
|
||||
GOPATH:=$(shell go env GOPATH)
|
||||
.PHONY: init
|
||||
init:
|
||||
go get -u github.com/golang/protobuf/proto
|
||||
go get -u github.com/golang/protobuf/protoc-gen-go
|
||||
go get github.com/micro/micro/v3/cmd/protoc-gen-micro
|
||||
|
||||
.PHONY: proto
|
||||
proto:
|
||||
protoc --proto_path=. --micro_out=. --go_out=:. proto/locations.proto
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
go build -o locations *.go
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
go test -v ./... -cover
|
||||
23
locations/README.md
Normal file
23
locations/README.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# Locations Service
|
||||
|
||||
This is the Locations service
|
||||
|
||||
Generated with
|
||||
|
||||
```
|
||||
micro new locations
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Generate the proto code
|
||||
|
||||
```
|
||||
make proto
|
||||
```
|
||||
|
||||
Run the service
|
||||
|
||||
```
|
||||
micro run .
|
||||
```
|
||||
2
locations/generate.go
Normal file
2
locations/generate.go
Normal file
@@ -0,0 +1,2 @@
|
||||
package main
|
||||
//go:generate make proto
|
||||
177
locations/handler/locations.go
Normal file
177
locations/handler/locations.go
Normal file
@@ -0,0 +1,177 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
geo "github.com/hailocab/go-geoindex"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"github.com/micro/micro/v3/service/errors"
|
||||
"github.com/micro/micro/v3/service/logger"
|
||||
"github.com/micro/services/locations/model"
|
||||
pb "github.com/micro/services/locations/proto"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrMissingLocations = errors.BadRequest("MISSING_LOCATIONS", "One or more locations are required")
|
||||
ErrMissingLatitude = errors.BadRequest("MISSING_LATITUDE", "Latitude is required")
|
||||
ErrMissingLongitude = errors.BadRequest("MISSING_LONGITUDE", "Longitude is required")
|
||||
ErrMissingUserID = errors.BadRequest("MISSING_USER_ID", "UserID is required")
|
||||
ErrMissingUserIDs = errors.BadRequest("MISSING_USER_IDS", "One or more UserIDs are required")
|
||||
ErrMissingBefore = errors.BadRequest("MISSING_BEFORE", "Before timestamp is required")
|
||||
ErrMissingAfter = errors.BadRequest("MISSING_AFTER", "After timestamp is required")
|
||||
ErrMissingRadius = errors.BadRequest("MISSING_RADIUS", "Radius is required")
|
||||
)
|
||||
|
||||
type Locations struct {
|
||||
sync.RWMutex
|
||||
|
||||
Geoindex *geo.PointsIndex
|
||||
DB *gorm.DB
|
||||
}
|
||||
|
||||
// Save a set of locations
|
||||
func (l *Locations) Save(ctx context.Context, req *pb.SaveRequest, rsp *pb.SaveResponse) error {
|
||||
// validate the request
|
||||
if len(req.Locations) == 0 {
|
||||
return ErrMissingLocations
|
||||
}
|
||||
for _, l := range req.Locations {
|
||||
if l.Latitude == nil {
|
||||
return ErrMissingLatitude
|
||||
}
|
||||
if l.Longitude == nil {
|
||||
return ErrMissingLongitude
|
||||
}
|
||||
if len(l.UserId) == 0 {
|
||||
return ErrMissingUserID
|
||||
}
|
||||
}
|
||||
|
||||
// construct the database objects
|
||||
ls := make([]*model.Location, len(req.Locations))
|
||||
for i, lc := range req.Locations {
|
||||
loc := &model.Location{
|
||||
ID: uuid.New().String(),
|
||||
UserID: lc.UserId,
|
||||
Latitude: lc.Latitude.Value,
|
||||
Longitude: lc.Longitude.Value,
|
||||
}
|
||||
if lc.Timestamp != nil {
|
||||
loc.Timestamp = lc.Timestamp.AsTime()
|
||||
} else {
|
||||
loc.Timestamp = time.Now()
|
||||
}
|
||||
ls[i] = loc
|
||||
}
|
||||
|
||||
// write to the database
|
||||
if err := l.DB.Create(ls).Error; err != nil {
|
||||
logger.Errorf("Error writing to the database: %v", err)
|
||||
return errors.InternalServerError("DATABASE_ERROR", "Error writing to the database")
|
||||
}
|
||||
|
||||
// write to the geoindex
|
||||
l.Lock()
|
||||
defer l.Unlock()
|
||||
for _, lc := range ls {
|
||||
l.Geoindex.Add(lc)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Last locations for a set of users
|
||||
func (l *Locations) Last(ctx context.Context, req *pb.LastRequest, rsp *pb.ListResponse) error {
|
||||
// validate the request
|
||||
if req.UserIds == nil {
|
||||
return ErrMissingUserIDs
|
||||
}
|
||||
|
||||
// query the database
|
||||
q := l.DB.Raw("SELECT DISTINCT ON (user_id) user_id, timestamp, latitude, longitude FROM locations WHERE user_id IN (?) ORDER BY user_id, timestamp DESC", req.UserIds)
|
||||
var locs []*model.Location
|
||||
if err := q.Find(&locs).Error; err != nil {
|
||||
logger.Errorf("Error reading from the database: %v", err)
|
||||
return errors.InternalServerError("DATABASE_ERROR", "Error reading from the database")
|
||||
}
|
||||
|
||||
// serialize the result
|
||||
rsp.Locations = serializeLocations(locs)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Near returns the locations near a point
|
||||
func (l *Locations) Near(ctx context.Context, req *pb.NearRequest, rsp *pb.ListResponse) error {
|
||||
// validate the request
|
||||
if req.Latitude == nil {
|
||||
return ErrMissingLatitude
|
||||
}
|
||||
if req.Longitude == nil {
|
||||
return ErrMissingLongitude
|
||||
}
|
||||
if req.Radius == nil {
|
||||
return ErrMissingRadius
|
||||
}
|
||||
|
||||
// query the geoindex
|
||||
l.RLock()
|
||||
p := geo.NewGeoPoint("query", req.Latitude.Value, req.Longitude.Value)
|
||||
result := l.Geoindex.PointsWithin(p, geo.Km(req.Radius.Value), func(p geo.Point) bool {
|
||||
return true
|
||||
})
|
||||
l.RUnlock()
|
||||
|
||||
// serialize the result
|
||||
locs := make([]*model.Location, len(result))
|
||||
for i, r := range result {
|
||||
locs[i] = r.(*model.Location)
|
||||
}
|
||||
rsp.Locations = serializeLocations(locs)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Read locations for a group of users between two points in time
|
||||
func (l *Locations) Read(ctx context.Context, req *pb.ReadRequest, rsp *pb.ListResponse) error {
|
||||
// validate the request
|
||||
if len(req.UserIds) == 0 {
|
||||
return ErrMissingUserIDs
|
||||
}
|
||||
if req.Before == nil {
|
||||
return ErrMissingBefore
|
||||
}
|
||||
if req.After == nil {
|
||||
return ErrMissingAfter
|
||||
}
|
||||
|
||||
// construct the request
|
||||
q := l.DB.Model(&model.Location{})
|
||||
q = q.Order("timestamp ASC")
|
||||
q = q.Where("user_id IN (?) AND timestamp > ? AND timestamp < ?", req.UserIds, req.After.AsTime(), req.Before.AsTime())
|
||||
var locs []*model.Location
|
||||
if err := q.Find(&locs).Error; err != nil {
|
||||
logger.Errorf("Error reading from the database: %v", err)
|
||||
return errors.InternalServerError("DATABASE_ERROR", "Error reading from the database")
|
||||
}
|
||||
|
||||
// serialize the result
|
||||
rsp.Locations = serializeLocations(locs)
|
||||
return nil
|
||||
}
|
||||
|
||||
func serializeLocations(locs []*model.Location) []*pb.Location {
|
||||
rsp := make([]*pb.Location, len(locs))
|
||||
for i, l := range locs {
|
||||
rsp[i] = &pb.Location{
|
||||
UserId: l.UserID,
|
||||
Latitude: &wrapperspb.DoubleValue{Value: l.Latitude},
|
||||
Longitude: &wrapperspb.DoubleValue{Value: l.Longitude},
|
||||
Timestamp: timestamppb.New(l.Timestamp),
|
||||
}
|
||||
}
|
||||
return rsp
|
||||
}
|
||||
519
locations/handler/locations_test.go
Normal file
519
locations/handler/locations_test.go
Normal file
@@ -0,0 +1,519 @@
|
||||
package handler_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sort"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
geo "github.com/hailocab/go-geoindex"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
"google.golang.org/protobuf/types/known/wrapperspb"
|
||||
"gorm.io/driver/postgres"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"github.com/micro/services/locations/handler"
|
||||
"github.com/micro/services/locations/model"
|
||||
pb "github.com/micro/services/locations/proto"
|
||||
)
|
||||
|
||||
func testHandler(t *testing.T) pb.LocationsHandler {
|
||||
// connect to the database
|
||||
db, err := gorm.Open(postgres.Open("postgresql://postgres@localhost:5432/locations?sslmode=disable"), &gorm.Config{})
|
||||
if err != nil {
|
||||
t.Fatalf("Error connecting to database: %v", err)
|
||||
}
|
||||
|
||||
// migrate the database
|
||||
if err := db.AutoMigrate(&model.Location{}); err != nil {
|
||||
t.Fatalf("Error migrating database: %v", err)
|
||||
}
|
||||
|
||||
// clean any data from a previous run
|
||||
if err := db.Exec("TRUNCATE TABLE locations CASCADE").Error; err != nil {
|
||||
t.Fatalf("Error cleaning database: %v", err)
|
||||
}
|
||||
|
||||
return &handler.Locations{DB: db, Geoindex: geo.NewPointsIndex(geo.Km(0.1))}
|
||||
}
|
||||
|
||||
func TestSave(t *testing.T) {
|
||||
tt := []struct {
|
||||
Name string
|
||||
Locations []*pb.Location
|
||||
Error error
|
||||
}{
|
||||
{
|
||||
Name: "NoLocations",
|
||||
Error: handler.ErrMissingLocations,
|
||||
},
|
||||
{
|
||||
Name: "NoLatitude",
|
||||
Locations: []*pb.Location{
|
||||
{
|
||||
Longitude: &wrapperspb.DoubleValue{Value: -0.1246},
|
||||
UserId: uuid.New().String(),
|
||||
},
|
||||
},
|
||||
Error: handler.ErrMissingLatitude,
|
||||
},
|
||||
{
|
||||
Name: "NoLongitude",
|
||||
Locations: []*pb.Location{
|
||||
{
|
||||
Latitude: &wrapperspb.DoubleValue{Value: -0.1246},
|
||||
UserId: uuid.New().String(),
|
||||
},
|
||||
},
|
||||
Error: handler.ErrMissingLongitude,
|
||||
},
|
||||
{
|
||||
Name: "OneLocation",
|
||||
Locations: []*pb.Location{
|
||||
{
|
||||
Latitude: &wrapperspb.DoubleValue{Value: 51.5007},
|
||||
Longitude: &wrapperspb.DoubleValue{Value: 0.1246},
|
||||
Timestamp: timestamppb.New(time.Now()),
|
||||
UserId: uuid.New().String(),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "ManyLocations",
|
||||
Locations: []*pb.Location{
|
||||
{
|
||||
Latitude: &wrapperspb.DoubleValue{Value: 51.5007},
|
||||
Longitude: &wrapperspb.DoubleValue{Value: 0.1246},
|
||||
Timestamp: timestamppb.New(time.Now()),
|
||||
UserId: uuid.New().String(),
|
||||
},
|
||||
{
|
||||
Latitude: &wrapperspb.DoubleValue{Value: 51.003},
|
||||
Longitude: &wrapperspb.DoubleValue{Value: -0.1246},
|
||||
UserId: uuid.New().String(),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
h := testHandler(t)
|
||||
|
||||
for _, tc := range tt {
|
||||
t.Run(tc.Name, func(t *testing.T) {
|
||||
err := h.Save(context.Background(), &pb.SaveRequest{
|
||||
Locations: tc.Locations,
|
||||
}, &pb.SaveResponse{})
|
||||
assert.Equal(t, tc.Error, err)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestLast(t *testing.T) {
|
||||
h := testHandler(t)
|
||||
|
||||
t.Run("MissingUserIDs", func(t *testing.T) {
|
||||
err := h.Last(context.Background(), &pb.LastRequest{}, &pb.ListResponse{})
|
||||
assert.Equal(t, handler.ErrMissingUserIDs, err)
|
||||
})
|
||||
|
||||
t.Run("NoMatches", func(t *testing.T) {
|
||||
var rsp pb.ListResponse
|
||||
err := h.Last(context.Background(), &pb.LastRequest{
|
||||
UserIds: []string{uuid.New().String()},
|
||||
}, &rsp)
|
||||
assert.NoError(t, err)
|
||||
assert.Empty(t, rsp.Locations)
|
||||
})
|
||||
|
||||
// generate some example data to work with
|
||||
loc1 := &pb.Location{
|
||||
Latitude: &wrapperspb.DoubleValue{Value: 51.5007},
|
||||
Longitude: &wrapperspb.DoubleValue{Value: 0.1246},
|
||||
Timestamp: timestamppb.New(time.Now()),
|
||||
UserId: "a",
|
||||
}
|
||||
loc2 := &pb.Location{
|
||||
Latitude: &wrapperspb.DoubleValue{Value: 51.6007},
|
||||
Longitude: &wrapperspb.DoubleValue{Value: 0.1546},
|
||||
Timestamp: timestamppb.New(time.Now()),
|
||||
UserId: "b",
|
||||
}
|
||||
loc3 := &pb.Location{
|
||||
Latitude: &wrapperspb.DoubleValue{Value: 52.6007},
|
||||
Longitude: &wrapperspb.DoubleValue{Value: 0.2546},
|
||||
Timestamp: timestamppb.New(time.Now()),
|
||||
UserId: loc2.UserId,
|
||||
}
|
||||
err := h.Save(context.TODO(), &pb.SaveRequest{
|
||||
Locations: []*pb.Location{loc1, loc2, loc3},
|
||||
}, &pb.SaveResponse{})
|
||||
assert.NoError(t, err)
|
||||
|
||||
t.Run("OneUser", func(t *testing.T) {
|
||||
var rsp pb.ListResponse
|
||||
err := h.Last(context.Background(), &pb.LastRequest{
|
||||
UserIds: []string{loc2.UserId},
|
||||
}, &rsp)
|
||||
assert.NoError(t, err)
|
||||
|
||||
if len(rsp.Locations) != 1 {
|
||||
t.Fatalf("One location should be returned")
|
||||
}
|
||||
assert.Equal(t, loc3.UserId, rsp.Locations[0].UserId)
|
||||
assert.Equal(t, loc3.Latitude.Value, rsp.Locations[0].Latitude.Value)
|
||||
assert.Equal(t, loc3.Longitude.Value, rsp.Locations[0].Longitude.Value)
|
||||
assert.Equal(t, loc3.Timestamp.AsTime(), rsp.Locations[0].Timestamp.AsTime())
|
||||
})
|
||||
t.Run("ManyUser", func(t *testing.T) {
|
||||
var rsp pb.ListResponse
|
||||
err := h.Last(context.Background(), &pb.LastRequest{
|
||||
UserIds: []string{loc1.UserId, loc2.UserId},
|
||||
}, &rsp)
|
||||
assert.NoError(t, err)
|
||||
|
||||
if len(rsp.Locations) != 2 {
|
||||
t.Fatalf("Two locations should be returned")
|
||||
}
|
||||
|
||||
// sort using user_id so we can hardcode the index
|
||||
sort.Slice(rsp.Locations, func(i, j int) bool {
|
||||
return rsp.Locations[i].UserId > rsp.Locations[j].UserId
|
||||
})
|
||||
|
||||
assert.Equal(t, loc1.UserId, rsp.Locations[1].UserId)
|
||||
assert.Equal(t, loc1.Latitude.Value, rsp.Locations[1].Latitude.Value)
|
||||
assert.Equal(t, loc1.Longitude.Value, rsp.Locations[1].Longitude.Value)
|
||||
assert.Equal(t, loc1.Timestamp.AsTime(), rsp.Locations[1].Timestamp.AsTime())
|
||||
|
||||
assert.Equal(t, loc3.UserId, rsp.Locations[0].UserId)
|
||||
assert.Equal(t, loc3.Latitude.Value, rsp.Locations[0].Latitude.Value)
|
||||
assert.Equal(t, loc3.Longitude.Value, rsp.Locations[0].Longitude.Value)
|
||||
assert.Equal(t, loc3.Timestamp.AsTime(), rsp.Locations[0].Timestamp.AsTime())
|
||||
})
|
||||
}
|
||||
|
||||
func TestNear(t *testing.T) {
|
||||
lat := &wrapperspb.DoubleValue{Value: 51.510357}
|
||||
lng := &wrapperspb.DoubleValue{Value: -0.116773}
|
||||
rad := &wrapperspb.DoubleValue{Value: 2.0}
|
||||
|
||||
inBoundsLat := &wrapperspb.DoubleValue{Value: 51.5110}
|
||||
inBoundsLng := &wrapperspb.DoubleValue{Value: -0.1142}
|
||||
|
||||
outOfBoundsLat := &wrapperspb.DoubleValue{Value: 51.5415}
|
||||
outOfBoundsLng := &wrapperspb.DoubleValue{Value: -0.0028}
|
||||
|
||||
tt := []struct {
|
||||
Name string
|
||||
Locations []*pb.Location
|
||||
Results []*pb.Location
|
||||
QueryLatitude *wrapperspb.DoubleValue
|
||||
QueryLongitude *wrapperspb.DoubleValue
|
||||
QueryRadius *wrapperspb.DoubleValue
|
||||
Error error
|
||||
}{
|
||||
{
|
||||
Name: "MissingLatitude",
|
||||
QueryLongitude: lng,
|
||||
QueryRadius: rad,
|
||||
Error: handler.ErrMissingLatitude,
|
||||
},
|
||||
{
|
||||
Name: "MissingLongitude",
|
||||
QueryLatitude: lat,
|
||||
QueryRadius: rad,
|
||||
Error: handler.ErrMissingLongitude,
|
||||
},
|
||||
{
|
||||
Name: "MissingRadius",
|
||||
QueryLatitude: lat,
|
||||
QueryLongitude: lng,
|
||||
Error: handler.ErrMissingRadius,
|
||||
},
|
||||
{
|
||||
Name: "NoLocations",
|
||||
QueryLatitude: lat,
|
||||
QueryLongitude: lng,
|
||||
QueryRadius: rad,
|
||||
},
|
||||
{
|
||||
Name: "OneWithinRadius",
|
||||
QueryLatitude: lat,
|
||||
QueryLongitude: lng,
|
||||
QueryRadius: rad,
|
||||
Locations: []*pb.Location{
|
||||
&pb.Location{
|
||||
Latitude: inBoundsLat,
|
||||
Longitude: inBoundsLng,
|
||||
UserId: "in",
|
||||
},
|
||||
&pb.Location{
|
||||
Latitude: outOfBoundsLat,
|
||||
Longitude: outOfBoundsLng,
|
||||
UserId: "out",
|
||||
},
|
||||
},
|
||||
Results: []*pb.Location{
|
||||
&pb.Location{
|
||||
Latitude: inBoundsLat,
|
||||
Longitude: inBoundsLng,
|
||||
UserId: "in",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "NoneWithinRadius",
|
||||
QueryLatitude: lat,
|
||||
QueryLongitude: lng,
|
||||
QueryRadius: &wrapperspb.DoubleValue{Value: 0.01},
|
||||
Locations: []*pb.Location{
|
||||
&pb.Location{
|
||||
Latitude: inBoundsLat,
|
||||
Longitude: inBoundsLng,
|
||||
UserId: "in",
|
||||
},
|
||||
&pb.Location{
|
||||
Latitude: outOfBoundsLat,
|
||||
Longitude: outOfBoundsLng,
|
||||
UserId: "out",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "TwoLocationsForUser",
|
||||
QueryLatitude: lat,
|
||||
QueryLongitude: lng,
|
||||
QueryRadius: rad,
|
||||
Locations: []*pb.Location{
|
||||
&pb.Location{
|
||||
Latitude: inBoundsLat,
|
||||
Longitude: inBoundsLng,
|
||||
UserId: "in",
|
||||
},
|
||||
&pb.Location{
|
||||
Latitude: outOfBoundsLat,
|
||||
Longitude: outOfBoundsLng,
|
||||
UserId: "out",
|
||||
},
|
||||
&pb.Location{
|
||||
Latitude: inBoundsLat,
|
||||
Longitude: inBoundsLng,
|
||||
UserId: "out",
|
||||
},
|
||||
},
|
||||
Results: []*pb.Location{
|
||||
&pb.Location{
|
||||
Latitude: inBoundsLat,
|
||||
Longitude: inBoundsLng,
|
||||
UserId: "in",
|
||||
},
|
||||
&pb.Location{
|
||||
Latitude: inBoundsLat,
|
||||
Longitude: inBoundsLng,
|
||||
UserId: "out",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "ManyWithinRadius",
|
||||
QueryLatitude: lat,
|
||||
QueryLongitude: lng,
|
||||
QueryRadius: &wrapperspb.DoubleValue{Value: 20},
|
||||
Locations: []*pb.Location{
|
||||
&pb.Location{
|
||||
Latitude: inBoundsLat,
|
||||
Longitude: inBoundsLng,
|
||||
UserId: "in",
|
||||
},
|
||||
&pb.Location{
|
||||
Latitude: outOfBoundsLat,
|
||||
Longitude: outOfBoundsLng,
|
||||
UserId: "out",
|
||||
},
|
||||
},
|
||||
Results: []*pb.Location{
|
||||
&pb.Location{
|
||||
Latitude: inBoundsLat,
|
||||
Longitude: inBoundsLng,
|
||||
UserId: "in",
|
||||
},
|
||||
&pb.Location{
|
||||
Latitude: outOfBoundsLat,
|
||||
Longitude: outOfBoundsLng,
|
||||
UserId: "out",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tt {
|
||||
t.Run(tc.Name, func(t *testing.T) {
|
||||
h := testHandler(t)
|
||||
|
||||
// create the locations
|
||||
if len(tc.Locations) > 0 {
|
||||
err := h.Save(context.TODO(), &pb.SaveRequest{Locations: tc.Locations}, &pb.SaveResponse{})
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
// find near locations
|
||||
var rsp pb.ListResponse
|
||||
err := h.Near(context.TODO(), &pb.NearRequest{
|
||||
Latitude: tc.QueryLatitude,
|
||||
Longitude: tc.QueryLongitude,
|
||||
Radius: tc.QueryRadius,
|
||||
}, &rsp)
|
||||
assert.Equal(t, tc.Error, err)
|
||||
|
||||
// check the count of the results matches
|
||||
if len(tc.Results) != len(rsp.Locations) {
|
||||
t.Errorf("Incorrect number of results returned. Expected %v, got %v", len(tc.Results), len(rsp.Locations))
|
||||
}
|
||||
|
||||
// validate the results match
|
||||
sort.Slice(rsp.Locations, func(i, j int) bool {
|
||||
return rsp.Locations[i].UserId > rsp.Locations[j].UserId
|
||||
})
|
||||
sort.Slice(tc.Results, func(i, j int) bool {
|
||||
return tc.Results[i].UserId > tc.Results[j].UserId
|
||||
})
|
||||
for i, r := range tc.Results {
|
||||
l := rsp.Locations[i]
|
||||
assert.Equal(t, r.UserId, l.UserId)
|
||||
assert.Equal(t, r.Latitude.Value, l.Latitude.Value)
|
||||
assert.Equal(t, r.Longitude.Value, l.Longitude.Value)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestRead(t *testing.T) {
|
||||
h := testHandler(t)
|
||||
|
||||
baseTime := time.Now().Add(time.Hour * -24)
|
||||
|
||||
t.Run("MissingUserIDs", func(t *testing.T) {
|
||||
err := h.Read(context.Background(), &pb.ReadRequest{
|
||||
After: timestamppb.New(baseTime),
|
||||
Before: timestamppb.New(baseTime),
|
||||
}, &pb.ListResponse{})
|
||||
assert.Equal(t, handler.ErrMissingUserIDs, err)
|
||||
})
|
||||
|
||||
t.Run("MissingAfter", func(t *testing.T) {
|
||||
err := h.Read(context.Background(), &pb.ReadRequest{
|
||||
UserIds: []string{uuid.New().String()},
|
||||
Before: timestamppb.New(baseTime),
|
||||
}, &pb.ListResponse{})
|
||||
assert.Equal(t, handler.ErrMissingAfter, err)
|
||||
})
|
||||
|
||||
t.Run("MissingBefore", func(t *testing.T) {
|
||||
err := h.Read(context.Background(), &pb.ReadRequest{
|
||||
UserIds: []string{uuid.New().String()},
|
||||
After: timestamppb.New(baseTime),
|
||||
}, &pb.ListResponse{})
|
||||
assert.Equal(t, handler.ErrMissingBefore, err)
|
||||
})
|
||||
|
||||
// generate some example data to work with
|
||||
loc1 := &pb.Location{
|
||||
Latitude: &wrapperspb.DoubleValue{Value: 51.5007},
|
||||
Longitude: &wrapperspb.DoubleValue{Value: 0.1246},
|
||||
Timestamp: timestamppb.New(baseTime.Add(time.Minute * 10)),
|
||||
UserId: "a",
|
||||
}
|
||||
loc2 := &pb.Location{
|
||||
Latitude: &wrapperspb.DoubleValue{Value: 51.6007},
|
||||
Longitude: &wrapperspb.DoubleValue{Value: 0.1546},
|
||||
Timestamp: timestamppb.New(baseTime.Add(time.Minute * 20)),
|
||||
UserId: "b",
|
||||
}
|
||||
loc3 := &pb.Location{
|
||||
Latitude: &wrapperspb.DoubleValue{Value: 52.6007},
|
||||
Longitude: &wrapperspb.DoubleValue{Value: 0.2546},
|
||||
Timestamp: timestamppb.New(baseTime.Add(time.Minute * 40)),
|
||||
UserId: loc2.UserId,
|
||||
}
|
||||
err := h.Save(context.TODO(), &pb.SaveRequest{
|
||||
Locations: []*pb.Location{loc1, loc2, loc3},
|
||||
}, &pb.SaveResponse{})
|
||||
assert.NoError(t, err)
|
||||
|
||||
t.Run("NoMatches", func(t *testing.T) {
|
||||
var rsp pb.ListResponse
|
||||
err := h.Read(context.Background(), &pb.ReadRequest{
|
||||
UserIds: []string{uuid.New().String()},
|
||||
After: timestamppb.New(baseTime),
|
||||
Before: timestamppb.New(baseTime.Add(time.Hour)),
|
||||
}, &rsp)
|
||||
assert.NoError(t, err)
|
||||
assert.Empty(t, rsp.Locations)
|
||||
})
|
||||
|
||||
t.Run("OneUserID", func(t *testing.T) {
|
||||
var rsp pb.ListResponse
|
||||
err := h.Read(context.Background(), &pb.ReadRequest{
|
||||
UserIds: []string{loc2.UserId},
|
||||
After: timestamppb.New(baseTime),
|
||||
Before: timestamppb.New(baseTime.Add(time.Hour)),
|
||||
}, &rsp)
|
||||
assert.NoError(t, err)
|
||||
|
||||
if len(rsp.Locations) != 2 {
|
||||
t.Fatalf("Two locations should be returned")
|
||||
}
|
||||
assert.Equal(t, loc2.UserId, rsp.Locations[0].UserId)
|
||||
assert.Equal(t, loc2.Latitude.Value, rsp.Locations[0].Latitude.Value)
|
||||
assert.Equal(t, loc2.Longitude.Value, rsp.Locations[0].Longitude.Value)
|
||||
assert.Equal(t, loc2.Timestamp.AsTime(), rsp.Locations[0].Timestamp.AsTime())
|
||||
|
||||
assert.Equal(t, loc3.UserId, rsp.Locations[1].UserId)
|
||||
assert.Equal(t, loc3.Latitude.Value, rsp.Locations[1].Latitude.Value)
|
||||
assert.Equal(t, loc3.Longitude.Value, rsp.Locations[1].Longitude.Value)
|
||||
assert.Equal(t, loc3.Timestamp.AsTime(), rsp.Locations[1].Timestamp.AsTime())
|
||||
})
|
||||
|
||||
t.Run("OneUserIDReducedTime", func(t *testing.T) {
|
||||
var rsp pb.ListResponse
|
||||
err := h.Read(context.Background(), &pb.ReadRequest{
|
||||
UserIds: []string{loc2.UserId},
|
||||
After: timestamppb.New(baseTime),
|
||||
Before: timestamppb.New(baseTime.Add(time.Minute * 30)),
|
||||
}, &rsp)
|
||||
assert.NoError(t, err)
|
||||
|
||||
if len(rsp.Locations) != 1 {
|
||||
t.Fatalf("One location should be returned")
|
||||
}
|
||||
assert.Equal(t, loc2.UserId, rsp.Locations[0].UserId)
|
||||
assert.Equal(t, loc2.Latitude.Value, rsp.Locations[0].Latitude.Value)
|
||||
assert.Equal(t, loc2.Longitude.Value, rsp.Locations[0].Longitude.Value)
|
||||
assert.Equal(t, loc2.Timestamp.AsTime(), rsp.Locations[0].Timestamp.AsTime())
|
||||
})
|
||||
|
||||
t.Run("TwoUserIDs", func(t *testing.T) {
|
||||
var rsp pb.ListResponse
|
||||
err := h.Read(context.Background(), &pb.ReadRequest{
|
||||
UserIds: []string{loc1.UserId, loc2.UserId},
|
||||
After: timestamppb.New(baseTime),
|
||||
Before: timestamppb.New(baseTime.Add(time.Minute * 30)),
|
||||
}, &rsp)
|
||||
assert.NoError(t, err)
|
||||
|
||||
if len(rsp.Locations) != 2 {
|
||||
t.Fatalf("Two locations should be returned")
|
||||
}
|
||||
assert.Equal(t, loc1.UserId, rsp.Locations[0].UserId)
|
||||
assert.Equal(t, loc1.Latitude.Value, rsp.Locations[0].Latitude.Value)
|
||||
assert.Equal(t, loc1.Longitude.Value, rsp.Locations[0].Longitude.Value)
|
||||
assert.Equal(t, loc1.Timestamp.AsTime(), rsp.Locations[0].Timestamp.AsTime())
|
||||
|
||||
assert.Equal(t, loc2.UserId, rsp.Locations[1].UserId)
|
||||
assert.Equal(t, loc2.Latitude.Value, rsp.Locations[1].Latitude.Value)
|
||||
assert.Equal(t, loc2.Longitude.Value, rsp.Locations[1].Longitude.Value)
|
||||
assert.Equal(t, loc2.Timestamp.AsTime(), rsp.Locations[1].Timestamp.AsTime())
|
||||
})
|
||||
}
|
||||
51
locations/main.go
Normal file
51
locations/main.go
Normal file
@@ -0,0 +1,51 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
geo "github.com/hailocab/go-geoindex"
|
||||
"gorm.io/driver/postgres"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"github.com/micro/services/locations/handler"
|
||||
"github.com/micro/services/locations/model"
|
||||
pb "github.com/micro/services/locations/proto"
|
||||
|
||||
"github.com/micro/micro/v3/service"
|
||||
"github.com/micro/micro/v3/service/config"
|
||||
"github.com/micro/micro/v3/service/logger"
|
||||
)
|
||||
|
||||
var dbAddress = "postgresql://postgres@localhost:5432/locations?sslmode=disable"
|
||||
|
||||
func main() {
|
||||
// Create service
|
||||
srv := service.New(
|
||||
service.Name("locations"),
|
||||
service.Version("latest"),
|
||||
)
|
||||
|
||||
// Connect to the database
|
||||
cfg, err := config.Get("locations.database")
|
||||
if err != nil {
|
||||
logger.Fatalf("Error loading config: %v", err)
|
||||
}
|
||||
addr := cfg.String(dbAddress)
|
||||
db, err := gorm.Open(postgres.Open(addr), &gorm.Config{})
|
||||
if err != nil {
|
||||
logger.Fatalf("Error connecting to database: %v", err)
|
||||
}
|
||||
|
||||
// Migrate the database
|
||||
if err := db.AutoMigrate(&model.Location{}); err != nil {
|
||||
logger.Fatalf("Error migrating database: %v", err)
|
||||
}
|
||||
|
||||
// Register handler
|
||||
pb.RegisterLocationsHandler(srv.Server(), &handler.Locations{
|
||||
DB: db, Geoindex: geo.NewPointsIndex(geo.Km(0.1)),
|
||||
})
|
||||
|
||||
// Run service
|
||||
if err := srv.Run(); err != nil {
|
||||
logger.Fatal(err)
|
||||
}
|
||||
}
|
||||
1
locations/micro.mu
Normal file
1
locations/micro.mu
Normal file
@@ -0,0 +1 @@
|
||||
service locations
|
||||
26
locations/model/location.go
Normal file
26
locations/model/location.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Location struct {
|
||||
ID string
|
||||
UserID string `gorm:"index"`
|
||||
Latitude float64
|
||||
Longitude float64
|
||||
Timestamp time.Time
|
||||
}
|
||||
|
||||
// use the user id for the geoindex so only one result is returned per user
|
||||
func (l *Location) Id() string {
|
||||
return l.UserID
|
||||
}
|
||||
|
||||
func (l *Location) Lat() float64 {
|
||||
return l.Latitude
|
||||
}
|
||||
|
||||
func (l *Location) Lon() float64 {
|
||||
return l.Longitude
|
||||
}
|
||||
643
locations/proto/locations.pb.go
Normal file
643
locations/proto/locations.pb.go
Normal file
@@ -0,0 +1,643 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.23.0
|
||||
// protoc v3.13.0
|
||||
// source: proto/locations.proto
|
||||
|
||||
package locations
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
timestamp "github.com/golang/protobuf/ptypes/timestamp"
|
||||
wrappers "github.com/golang/protobuf/ptypes/wrappers"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type Location struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
|
||||
Timestamp *timestamp.Timestamp `protobuf:"bytes,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
|
||||
Latitude *wrappers.DoubleValue `protobuf:"bytes,3,opt,name=latitude,proto3" json:"latitude,omitempty"`
|
||||
Longitude *wrappers.DoubleValue `protobuf:"bytes,4,opt,name=longitude,proto3" json:"longitude,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Location) Reset() {
|
||||
*x = Location{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_locations_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Location) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Location) ProtoMessage() {}
|
||||
|
||||
func (x *Location) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_locations_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Location.ProtoReflect.Descriptor instead.
|
||||
func (*Location) Descriptor() ([]byte, []int) {
|
||||
return file_proto_locations_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Location) GetUserId() string {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Location) GetTimestamp() *timestamp.Timestamp {
|
||||
if x != nil {
|
||||
return x.Timestamp
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Location) GetLatitude() *wrappers.DoubleValue {
|
||||
if x != nil {
|
||||
return x.Latitude
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Location) GetLongitude() *wrappers.DoubleValue {
|
||||
if x != nil {
|
||||
return x.Longitude
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type SaveRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Locations []*Location `protobuf:"bytes,1,rep,name=locations,proto3" json:"locations,omitempty"`
|
||||
}
|
||||
|
||||
func (x *SaveRequest) Reset() {
|
||||
*x = SaveRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_locations_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SaveRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SaveRequest) ProtoMessage() {}
|
||||
|
||||
func (x *SaveRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_locations_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SaveRequest.ProtoReflect.Descriptor instead.
|
||||
func (*SaveRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_locations_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *SaveRequest) GetLocations() []*Location {
|
||||
if x != nil {
|
||||
return x.Locations
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type SaveResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
}
|
||||
|
||||
func (x *SaveResponse) Reset() {
|
||||
*x = SaveResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_locations_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SaveResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SaveResponse) ProtoMessage() {}
|
||||
|
||||
func (x *SaveResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_locations_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SaveResponse.ProtoReflect.Descriptor instead.
|
||||
func (*SaveResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_locations_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
type LastRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
UserIds []string `protobuf:"bytes,1,rep,name=user_ids,json=userIds,proto3" json:"user_ids,omitempty"`
|
||||
}
|
||||
|
||||
func (x *LastRequest) Reset() {
|
||||
*x = LastRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_locations_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *LastRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*LastRequest) ProtoMessage() {}
|
||||
|
||||
func (x *LastRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_locations_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use LastRequest.ProtoReflect.Descriptor instead.
|
||||
func (*LastRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_locations_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *LastRequest) GetUserIds() []string {
|
||||
if x != nil {
|
||||
return x.UserIds
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ListResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Locations []*Location `protobuf:"bytes,1,rep,name=locations,proto3" json:"locations,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ListResponse) Reset() {
|
||||
*x = ListResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_locations_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ListResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ListResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_locations_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ListResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ListResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_locations_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *ListResponse) GetLocations() []*Location {
|
||||
if x != nil {
|
||||
return x.Locations
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type NearRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
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"`
|
||||
}
|
||||
|
||||
func (x *NearRequest) Reset() {
|
||||
*x = NearRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_locations_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *NearRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*NearRequest) ProtoMessage() {}
|
||||
|
||||
func (x *NearRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_locations_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use NearRequest.ProtoReflect.Descriptor instead.
|
||||
func (*NearRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_locations_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *NearRequest) GetLatitude() *wrappers.DoubleValue {
|
||||
if x != nil {
|
||||
return x.Latitude
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NearRequest) GetLongitude() *wrappers.DoubleValue {
|
||||
if x != nil {
|
||||
return x.Longitude
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NearRequest) GetRadius() *wrappers.DoubleValue {
|
||||
if x != nil {
|
||||
return x.Radius
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ReadRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
UserIds []string `protobuf:"bytes,1,rep,name=user_ids,json=userIds,proto3" json:"user_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"`
|
||||
}
|
||||
|
||||
func (x *ReadRequest) Reset() {
|
||||
*x = ReadRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_locations_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ReadRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ReadRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ReadRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_locations_proto_msgTypes[6]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ReadRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ReadRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_locations_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *ReadRequest) GetUserIds() []string {
|
||||
if x != nil {
|
||||
return x.UserIds
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ReadRequest) GetAfter() *timestamp.Timestamp {
|
||||
if x != nil {
|
||||
return x.After
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ReadRequest) GetBefore() *timestamp.Timestamp {
|
||||
if x != nil {
|
||||
return x.Before
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_proto_locations_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_proto_locations_proto_rawDesc = []byte{
|
||||
0x0a, 0x15, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x73, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x22, 0xd3, 0x01, 0x0a, 0x08, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67,
|
||||
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54,
|
||||
0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74,
|
||||
0x61, 0x6d, 0x70, 0x12, 0x38, 0x0a, 0x08, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61,
|
||||
0x6c, 0x75, 0x65, 0x52, 0x08, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x3a, 0x0a,
|
||||
0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
|
||||
0x75, 0x66, 0x2e, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x09,
|
||||
0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x22, 0x40, 0x0a, 0x0b, 0x53, 0x61, 0x76,
|
||||
0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x31, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6c, 0x6f,
|
||||
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x52, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x0e, 0x0a, 0x0c, 0x53,
|
||||
0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x0a, 0x0b, 0x4c,
|
||||
0x61, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x75, 0x73,
|
||||
0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x75, 0x73,
|
||||
0x65, 0x72, 0x49, 0x64, 0x73, 0x22, 0x41, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6c,
|
||||
0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xb9, 0x01, 0x0a, 0x0b, 0x4e, 0x65, 0x61,
|
||||
0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x08, 0x6c, 0x61, 0x74, 0x69,
|
||||
0x74, 0x75, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f,
|
||||
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x6f, 0x75,
|
||||
0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x08, 0x6c, 0x61, 0x74, 0x69, 0x74, 0x75,
|
||||
0x64, 0x65, 0x12, 0x3a, 0x0a, 0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61,
|
||||
0x6c, 0x75, 0x65, 0x52, 0x09, 0x6c, 0x6f, 0x6e, 0x67, 0x69, 0x74, 0x75, 0x64, 0x65, 0x12, 0x34,
|
||||
0x0a, 0x06, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c,
|
||||
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
|
||||
0x2e, 0x44, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x72, 0x61,
|
||||
0x64, 0x69, 0x75, 0x73, 0x22, 0x8e, 0x01, 0x0a, 0x0b, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73,
|
||||
0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x73, 0x12,
|
||||
0x30, 0x0a, 0x05, 0x61, 0x66, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a,
|
||||
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
|
||||
0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x05, 0x61, 0x66, 0x74, 0x65,
|
||||
0x72, 0x12, 0x32, 0x0a, 0x06, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x06, 0x62,
|
||||
0x65, 0x66, 0x6f, 0x72, 0x65, 0x32, 0xf7, 0x01, 0x0a, 0x09, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x73, 0x12, 0x39, 0x0a, 0x04, 0x53, 0x61, 0x76, 0x65, 0x12, 0x16, 0x2e, 0x6c, 0x6f,
|
||||
0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e,
|
||||
0x53, 0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x39,
|
||||
0x0a, 0x04, 0x4c, 0x61, 0x73, 0x74, 0x12, 0x16, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x73, 0x2e, 0x4c, 0x61, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17,
|
||||
0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x04, 0x4e, 0x65, 0x61,
|
||||
0x72, 0x12, 0x16, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4e, 0x65,
|
||||
0x61, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6c, 0x6f, 0x63, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x04, 0x52, 0x65, 0x61, 0x64, 0x12, 0x16, 0x2e, 0x6c,
|
||||
0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
|
||||
0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42,
|
||||
0x35, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x69,
|
||||
0x63, 0x72, 0x6f, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x6c, 0x6f, 0x63,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x6c, 0x6f, 0x63,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_proto_locations_proto_rawDescOnce sync.Once
|
||||
file_proto_locations_proto_rawDescData = file_proto_locations_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_proto_locations_proto_rawDescGZIP() []byte {
|
||||
file_proto_locations_proto_rawDescOnce.Do(func() {
|
||||
file_proto_locations_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_locations_proto_rawDescData)
|
||||
})
|
||||
return file_proto_locations_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_proto_locations_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
|
||||
var file_proto_locations_proto_goTypes = []interface{}{
|
||||
(*Location)(nil), // 0: locations.Location
|
||||
(*SaveRequest)(nil), // 1: locations.SaveRequest
|
||||
(*SaveResponse)(nil), // 2: locations.SaveResponse
|
||||
(*LastRequest)(nil), // 3: locations.LastRequest
|
||||
(*ListResponse)(nil), // 4: locations.ListResponse
|
||||
(*NearRequest)(nil), // 5: locations.NearRequest
|
||||
(*ReadRequest)(nil), // 6: locations.ReadRequest
|
||||
(*timestamp.Timestamp)(nil), // 7: google.protobuf.Timestamp
|
||||
(*wrappers.DoubleValue)(nil), // 8: google.protobuf.DoubleValue
|
||||
}
|
||||
var file_proto_locations_proto_depIdxs = []int32{
|
||||
7, // 0: locations.Location.timestamp:type_name -> google.protobuf.Timestamp
|
||||
8, // 1: locations.Location.latitude:type_name -> google.protobuf.DoubleValue
|
||||
8, // 2: locations.Location.longitude:type_name -> google.protobuf.DoubleValue
|
||||
0, // 3: locations.SaveRequest.locations:type_name -> locations.Location
|
||||
0, // 4: locations.ListResponse.locations:type_name -> locations.Location
|
||||
8, // 5: locations.NearRequest.latitude:type_name -> google.protobuf.DoubleValue
|
||||
8, // 6: locations.NearRequest.longitude:type_name -> google.protobuf.DoubleValue
|
||||
8, // 7: locations.NearRequest.radius:type_name -> google.protobuf.DoubleValue
|
||||
7, // 8: locations.ReadRequest.after:type_name -> google.protobuf.Timestamp
|
||||
7, // 9: locations.ReadRequest.before:type_name -> google.protobuf.Timestamp
|
||||
1, // 10: locations.Locations.Save:input_type -> locations.SaveRequest
|
||||
3, // 11: locations.Locations.Last:input_type -> locations.LastRequest
|
||||
5, // 12: locations.Locations.Near:input_type -> locations.NearRequest
|
||||
6, // 13: locations.Locations.Read:input_type -> locations.ReadRequest
|
||||
2, // 14: locations.Locations.Save:output_type -> locations.SaveResponse
|
||||
4, // 15: locations.Locations.Last:output_type -> locations.ListResponse
|
||||
4, // 16: locations.Locations.Near:output_type -> locations.ListResponse
|
||||
4, // 17: locations.Locations.Read:output_type -> locations.ListResponse
|
||||
14, // [14:18] is the sub-list for method output_type
|
||||
10, // [10:14] is the sub-list for method input_type
|
||||
10, // [10:10] is the sub-list for extension type_name
|
||||
10, // [10:10] is the sub-list for extension extendee
|
||||
0, // [0:10] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_proto_locations_proto_init() }
|
||||
func file_proto_locations_proto_init() {
|
||||
if File_proto_locations_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_proto_locations_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Location); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_locations_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SaveRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_locations_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SaveResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_locations_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*LastRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_locations_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ListResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_locations_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*NearRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_proto_locations_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ReadRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_proto_locations_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 7,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_proto_locations_proto_goTypes,
|
||||
DependencyIndexes: file_proto_locations_proto_depIdxs,
|
||||
MessageInfos: file_proto_locations_proto_msgTypes,
|
||||
}.Build()
|
||||
File_proto_locations_proto = out.File
|
||||
file_proto_locations_proto_rawDesc = nil
|
||||
file_proto_locations_proto_goTypes = nil
|
||||
file_proto_locations_proto_depIdxs = nil
|
||||
}
|
||||
154
locations/proto/locations.pb.micro.go
Normal file
154
locations/proto/locations.pb.micro.go
Normal file
@@ -0,0 +1,154 @@
|
||||
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
||||
// source: proto/locations.proto
|
||||
|
||||
package locations
|
||||
|
||||
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 Locations service
|
||||
|
||||
func NewLocationsEndpoints() []*api.Endpoint {
|
||||
return []*api.Endpoint{}
|
||||
}
|
||||
|
||||
// Client API for Locations service
|
||||
|
||||
type LocationsService interface {
|
||||
// Save a set of locations
|
||||
Save(ctx context.Context, in *SaveRequest, opts ...client.CallOption) (*SaveResponse, error)
|
||||
// Last locations for a set of users
|
||||
Last(ctx context.Context, in *LastRequest, opts ...client.CallOption) (*ListResponse, error)
|
||||
// Near returns the locations near a point at a given time
|
||||
Near(ctx context.Context, in *NearRequest, opts ...client.CallOption) (*ListResponse, error)
|
||||
// Read locations for a group of users between two points in time
|
||||
Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ListResponse, error)
|
||||
}
|
||||
|
||||
type locationsService struct {
|
||||
c client.Client
|
||||
name string
|
||||
}
|
||||
|
||||
func NewLocationsService(name string, c client.Client) LocationsService {
|
||||
return &locationsService{
|
||||
c: c,
|
||||
name: name,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *locationsService) Save(ctx context.Context, in *SaveRequest, opts ...client.CallOption) (*SaveResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "Locations.Save", in)
|
||||
out := new(SaveResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *locationsService) Last(ctx context.Context, in *LastRequest, opts ...client.CallOption) (*ListResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "Locations.Last", in)
|
||||
out := new(ListResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *locationsService) Near(ctx context.Context, in *NearRequest, opts ...client.CallOption) (*ListResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "Locations.Near", in)
|
||||
out := new(ListResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *locationsService) Read(ctx context.Context, in *ReadRequest, opts ...client.CallOption) (*ListResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "Locations.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 Locations service
|
||||
|
||||
type LocationsHandler interface {
|
||||
// Save a set of locations
|
||||
Save(context.Context, *SaveRequest, *SaveResponse) error
|
||||
// Last locations for a set of users
|
||||
Last(context.Context, *LastRequest, *ListResponse) error
|
||||
// Near returns the locations near a point at a given time
|
||||
Near(context.Context, *NearRequest, *ListResponse) error
|
||||
// Read locations for a group of users between two points in time
|
||||
Read(context.Context, *ReadRequest, *ListResponse) error
|
||||
}
|
||||
|
||||
func RegisterLocationsHandler(s server.Server, hdlr LocationsHandler, opts ...server.HandlerOption) error {
|
||||
type locations 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 Locations struct {
|
||||
locations
|
||||
}
|
||||
h := &locationsHandler{hdlr}
|
||||
return s.Handle(s.NewHandler(&Locations{h}, opts...))
|
||||
}
|
||||
|
||||
type locationsHandler struct {
|
||||
LocationsHandler
|
||||
}
|
||||
|
||||
func (h *locationsHandler) Save(ctx context.Context, in *SaveRequest, out *SaveResponse) error {
|
||||
return h.LocationsHandler.Save(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *locationsHandler) Last(ctx context.Context, in *LastRequest, out *ListResponse) error {
|
||||
return h.LocationsHandler.Last(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *locationsHandler) Near(ctx context.Context, in *NearRequest, out *ListResponse) error {
|
||||
return h.LocationsHandler.Near(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *locationsHandler) Read(ctx context.Context, in *ReadRequest, out *ListResponse) error {
|
||||
return h.LocationsHandler.Read(ctx, in, out)
|
||||
}
|
||||
52
locations/proto/locations.proto
Normal file
52
locations/proto/locations.proto
Normal file
@@ -0,0 +1,52 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package locations;
|
||||
option go_package = "github.com/micro/services/locations/proto;locations";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
|
||||
service Locations {
|
||||
// Save a set of locations
|
||||
rpc Save(SaveRequest) returns (SaveResponse) {}
|
||||
// Last locations for a set of users
|
||||
rpc Last(LastRequest) returns (ListResponse) {}
|
||||
// Near returns the locations near a point at a given time
|
||||
rpc Near(NearRequest) returns (ListResponse) {}
|
||||
// Read locations for a group of users between two points in time
|
||||
rpc Read(ReadRequest) returns (ListResponse) {}
|
||||
}
|
||||
|
||||
message Location {
|
||||
string user_id = 1;
|
||||
google.protobuf.Timestamp timestamp = 2;
|
||||
google.protobuf.DoubleValue latitude = 3;
|
||||
google.protobuf.DoubleValue longitude = 4;
|
||||
}
|
||||
|
||||
message SaveRequest {
|
||||
repeated Location locations = 1;
|
||||
}
|
||||
|
||||
message SaveResponse {}
|
||||
|
||||
message LastRequest {
|
||||
repeated string user_ids = 1;
|
||||
}
|
||||
|
||||
message ListResponse {
|
||||
repeated Location locations = 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 user_ids = 1;
|
||||
google.protobuf.Timestamp after = 2;
|
||||
google.protobuf.Timestamp before = 3;
|
||||
}
|
||||
Reference in New Issue
Block a user