From 1b312ddc5dc0e66e555f1fe336262442ad7da482 Mon Sep 17 00:00:00 2001 From: CoderBear801 Date: Sat, 7 Mar 2020 16:08:18 -0800 Subject: [PATCH 1/2] feat: implement internal solution format. issue: https://github.com/Telenav/osrm-backend/issues/143 --- integration/oasis/solutionformat/doc.go | 7 ++++++ integration/oasis/solutionformat/solution.go | 26 ++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 integration/oasis/solutionformat/doc.go create mode 100644 integration/oasis/solutionformat/solution.go diff --git a/integration/oasis/solutionformat/doc.go b/integration/oasis/solutionformat/doc.go new file mode 100644 index 00000000000..d9fd4edb8c6 --- /dev/null +++ b/integration/oasis/solutionformat/doc.go @@ -0,0 +1,7 @@ +/* +package solutionformat defines internal foramt for recording single solution result. +It isolates internal calculation logic and final restful response: +- Internal algorithm will calculate result in this format. +- In the end, oasis will use this format to generate restful response. +*/ +package solutionformat diff --git a/integration/oasis/solutionformat/solution.go b/integration/oasis/solutionformat/solution.go new file mode 100644 index 00000000000..edc333bbc20 --- /dev/null +++ b/integration/oasis/solutionformat/solution.go @@ -0,0 +1,26 @@ +package solutionformat + +// Solution contains summary and selected charge stations +type Solution struct { + Distance float64 + Duration float64 + RemainingRage float64 + Weight float64 + ChargeStations []*ChargeStation +} + +// ChargeStation contains all information related with specific charge station +type ChargeStation struct { + Location Location + StationID string + ArrivalEnergy float64 + WaitTime float64 + ChargeTime float64 + ChargeRange float64 +} + +// Location defines the geo location of a station +type Location struct { + Lat float64 + Lon float64 +} From 00fc9e3278fd4d946be2459d4fb177eee8cf4bec Mon Sep 17 00:00:00 2001 From: CoderBear801 Date: Mon, 9 Mar 2020 11:35:09 -0700 Subject: [PATCH 2/2] fix: rename solutionformat-> solution --- integration/oasis/{solutionformat => solution}/doc.go | 4 ++-- integration/oasis/{solutionformat => solution}/solution.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename integration/oasis/{solutionformat => solution}/doc.go (65%) rename integration/oasis/{solutionformat => solution}/solution.go (96%) diff --git a/integration/oasis/solutionformat/doc.go b/integration/oasis/solution/doc.go similarity index 65% rename from integration/oasis/solutionformat/doc.go rename to integration/oasis/solution/doc.go index d9fd4edb8c6..025b66e0061 100644 --- a/integration/oasis/solutionformat/doc.go +++ b/integration/oasis/solution/doc.go @@ -1,7 +1,7 @@ /* -package solutionformat defines internal foramt for recording single solution result. +package solution defines internal foramt for recording single solution result. It isolates internal calculation logic and final restful response: - Internal algorithm will calculate result in this format. - In the end, oasis will use this format to generate restful response. */ -package solutionformat +package solution diff --git a/integration/oasis/solutionformat/solution.go b/integration/oasis/solution/solution.go similarity index 96% rename from integration/oasis/solutionformat/solution.go rename to integration/oasis/solution/solution.go index edc333bbc20..181e72f2c3e 100644 --- a/integration/oasis/solutionformat/solution.go +++ b/integration/oasis/solution/solution.go @@ -1,4 +1,4 @@ -package solutionformat +package solution // Solution contains summary and selected charge stations type Solution struct {