(ctx context.Context, args []string)
| 643 | } |
| 644 | |
| 645 | func (l location) Predicate(ctx context.Context, args []string) (*Constraint, error) { |
| 646 | where := args[0] |
| 647 | coords := strings.Split(where, ",") |
| 648 | if len(coords) != 4 { |
| 649 | return nil, fmt.Errorf("got %d coordinates for location area, expected 4", len(coords)) |
| 650 | } |
| 651 | asFloat := make([]float64, 4) |
| 652 | for k, v := range coords { |
| 653 | coo, err := strconv.ParseFloat(v, 64) |
| 654 | if err != nil { |
| 655 | return nil, fmt.Errorf("could not convert location area coordinate as a float: %v", err) |
| 656 | } |
| 657 | asFloat[k] = coo |
| 658 | } |
| 659 | rects := []geocode.Rect{ |
| 660 | { |
| 661 | NorthEast: geocode.LatLong{ |
| 662 | Lat: asFloat[0], |
| 663 | Long: asFloat[3], |
| 664 | }, |
| 665 | SouthWest: geocode.LatLong{ |
| 666 | Lat: asFloat[2], |
| 667 | Long: asFloat[1], |
| 668 | }, |
| 669 | }, |
| 670 | } |
| 671 | return locationPredicate(ctx, rects) |
| 672 | } |
| 673 | |
| 674 | type hasLocation struct { |
| 675 | matchEqual |
nothing calls this directly
no test coverage detected