fluent-postgis icon indicating copy to clipboard operation
fluent-postgis copied to clipboard

Optional type

Open shial4 opened this issue 6 years ago • 1 comments

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()

shial4 avatar Sep 12 '19 09:09 shial4

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 :/

rabc avatar Dec 09 '19 09:12 rabc