Skip to content

Feedback: implementation of key helpers like geoDistance()and via() #10

@sergio9929

Description

@sergio9929

PocketBase v0.27.0 has introduced a new field type GeoPoint, along with a new function geoDistance(), which can be used in API rules and queries.

Here are our proposals for implementing this new function:

const point = {
  lon: 10,
  lat: 12,
}

pbQuery<User>()
  .greaterThan('location', distanceFrom(point, 25)) // 25km
  .build(pb.filter)
  // geoDistance(location.lon, location.lat, 10, 12)>25

pbQuery<User>()
  .greaterThan(geoDistance('location', point), 25) // 25km
  .build(pb.filter)
  // geoDistance(location.lon, location.lat, 10, 12)>25

To align with PocketBase's querying syntax, we prefer the second option:

pbQuery<User>()
  .greaterThan(geoDistance('location', point), 25) // 25km
  .build(pb.filter)
  // geoDistance(location.lon, location.lat, 10, 12)>25

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions