func parsePriceLevels(minPrice string, maxPrice string, r *maps.NearbySearchRequest) { if minPrice != "" { r.MinPrice = parsePriceLevel(minPrice) } if maxPrice != "" { r.MaxPrice = parsePriceLevel(minPrice) } }
func parseRankBy(rankBy string, r *maps.NearbySearchRequest) { switch rankBy { case "prominence": r.RankBy = maps.RankByProminence return case "distance": r.RankBy = maps.RankByDistance return case "": return default: usageAndExit(fmt.Sprintf("Unknown rank by: \"%v\"", rankBy)) } }
func parseLocation(location string, r *maps.NearbySearchRequest) { if location != "" { l, err := maps.ParseLatLng(location) check(err) r.Location = &l } }
func parsePlaceType(placeType string, r *maps.NearbySearchRequest) { if placeType != "" { t, err := maps.ParsePlaceType(placeType) if err != nil { usageAndExit(fmt.Sprintf("Unknown place type \"%v\"", placeType)) } r.Type = t } }