We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
@tidwall Currently, try to perform Nearby function in driver detail in a concurrent manner. I currently use the graphql-go method to fetch the APIs.
current Nearby function
My go-routine method (Resolve function)
`func GetNearbyUser() *graphql.Field { return &graphql.Field{ Type: graphql.NewList(types.NearbyType), Args: graphql.FieldConfigArgument{
"latitude": &graphql.ArgumentConfig{ Type: graphql.NewNonNull(graphql.Float), }, "longitude": &graphql.ArgumentConfig{ Type: graphql.NewNonNull(graphql.Float), }, "collection": &graphql.ArgumentConfig{ Type: graphql.NewNonNull(graphql.String), }, "radius": &graphql.ArgumentConfig{ Type: graphql.Float, DefaultValue: 2000.00, }, }, Resolve: func(params graphql.ResolveParams) (interface{}, error) { ch := make(chan []types.NearbyLocation) go func() { var Lat = params.Args["latitude"].(float64) var Long = params.Args["longitude"].(float64) var radius = params.Args["radius"].(float64) var collection = params.Args["collection"].(string) response, _ := tile38.Nearby(collection, Lat, Long, radius) ch <- response }() return func() interface{} { return <-ch }, nil }, }
}`
Error Result
query : query {nearbyUser(collection:"driver",latitude:8.55652,longitude:76.872894,radius:2000){latitude,longitude,id}}
query {nearbyUser(collection:"driver",latitude:8.55652,longitude:76.872894,radius:2000){latitude,longitude,id}}
The text was updated successfully, but these errors were encountered:
The error you are getting does not appear to be related to Tile38 and I'm unfamiliar with graphql.
But at first glance, you appear to be running into some type of Go syntax error.
Perhaps your Resolve function should be something like:
Resolve: func(params graphql.ResolveParams) (interface{}, error) { return func() (interface{}, error) { var Lat = params.Args["latitude"].(float64) var Long = params.Args["longitude"].(float64) var radius = params.Args["radius"].(float64) var collection = params.Args["collection"].(string) resp, err := tile38.Nearby(collection, Lat, Long, radius) return resp, err }, nil }
You may want to ask this question on a graphql-go forum.
Sorry, something went wrong.
@tidwall, Thank you for your valuable suggestion
No branches or pull requests
@tidwall
Currently, try to perform Nearby function in driver detail in a concurrent manner. I currently use the graphql-go method to fetch the APIs.
current Nearby function
My go-routine method (Resolve function)
`func GetNearbyUser() *graphql.Field {
return &graphql.Field{
Type: graphql.NewList(types.NearbyType),
Args: graphql.FieldConfigArgument{
}`
Error Result
query :
query {nearbyUser(collection:"driver",latitude:8.55652,longitude:76.872894,radius:2000){latitude,longitude,id}}
The text was updated successfully, but these errors were encountered: