-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat:implement local station finder based on google:s2 indexer #278
Conversation
-1) | ||
sf.bf.getNearbyChargeStations(req) | ||
return | ||
} | ||
|
||
func (sf *lowEnergyLocationStationFinder) IterateNearbyStations() <-chan stationfindertype.ChargeStationInfo { | ||
func (sf *lowEnergyLocationStationFinder) IterateNearbyStations() <-chan *stationfindertype.ChargeStationInfo { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: use l
instead of sf
might be better as convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy that, use l
or meaningful name.
var r []stationfindertype.ChargeStationInfo | ||
var r []*stationfindertype.ChargeStationInfo | ||
|
||
isdoneC := make(chan bool) | ||
go func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not remove go func()
, go with the for
loop directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will go with that.
return nil, err | ||
} | ||
|
||
switch finderType { | ||
|
||
case TNSearchFinder: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unify name?
) | ||
|
||
// MockChargeStationInfo1 mocks array of *ChargeStationInfo which is compatible with spatialindexer.MockPlaceInfo1 | ||
var MockChargeStationInfo1 = []*ChargeStationInfo{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why export the mock var?
@@ -1,6 +1,7 @@ | |||
package spatialindexer | |||
|
|||
var mockPlaceInfo1 = []*PointInfo{ | |||
// MockPlaceInfo1 contains 10 PointInfo items | |||
var MockPlaceInfo1 = []*PointInfo{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why export the mock var?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to use which to evaluate result
package A defines some common data structures
package B use that common data structures and returns some result, I use package A's mock result to evaluate whether result is the same as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then the B
will strongly depends on A
, which may should not. Maybe you could write some test
packages to test the scenario like this?
Issue
#240
Major changes
Minor changes
<-chan stationfindertype.ChargeStationInfo
to<-chan *stationfindertype.ChargeStationInfo
, original strategy is easy to create bugs while convert channel result into pointers https://play.golang.org/p/gWgJpEOSuj6To do
spatialindexer.PointInfo
tospatialindexer.PlaceInfo
spatialindexer.Location
tonav.Location
Stop
functionality into Station Finder's algorithmsTasklist