fluent-postgis
fluent-postgis copied to clipboard
Optional type
I have model
final class Organization: PostgreSQLModel {
var id: Int?
var location: GeographicPoint2D?
}
However, I do receive error when passing KeyPath
Cannot convert value of type 'ReferenceWritableKeyPath<Organization, GeographicPoint2D?>' to expected argument type 'PostgreSQLDatabase.QueryField' (aka 'GenericSQLColumnIdentifier<GenericSQLTableIdentifier<GenericSQLIdentifier>, GenericSQLIdentifier>')
.filterGeometryDistanceWithin(\Organization.location, searchLocation, distance).all()
It does work when I do it with force unwrap
.filterGeometryDistanceWithin(\Organization.location!, searchLocation, distance).all()
I had the exact same error, you can see my solution here: https://github.com/plarson/fluent-postgis/issues/1
Looks like the owner of this project is not actively looking it anymore :/