Last active
August 18, 2021 04:50
-
-
Save daneshk/e0ab3bf320be516a306b2e8d4997203a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service "RouteGuide" on new grpc:Listener(8980) { | |
remote function ListFeatures(Rectangle rectangle) returns stream<Feature, grpc:Error?>|error { | |
int left = int:min(rectangle.lo.longitude, rectangle.hi.longitude); | |
int right = int:max(rectangle.lo.longitude, rectangle.hi.longitude); | |
int top = int:max(rectangle.lo.latitude, rectangle.hi.latitude); | |
int bottom = int:min(rectangle.lo.latitude, rectangle.hi.latitude); | |
Feature[] selectedFeatures = from var feature in FEATURES | |
where feature.name != "" | |
where feature.location.longitude >= left | |
where feature.location.longitude <= right | |
where feature.location.latitude >= bottom | |
where feature.location.latitude <= top | |
select feature; | |
return selectedFeatures.toStream(); | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment