December 2017
Intermediate to advanced
260 pages
7h 34m
English
Unfortunately, Exposed doesn't natively support PostGIS functionality such as geometry types or geospatial requests. This is an excellent opportunity to use Extension functions by Kotlin and fill the missing support without modifying the original source.
Adding support for location
The location data for the message is in the form of coordinates. To store such a data structure in the database, we define PointColumnType to store and get the location data for the message:
* It represents the point column type for Exposed */ class PointColumnType(private val srid: Int = 4326) : ColumnType() { override fun sqlType() = "GEOMETRY(Point, $srid)" override fun valueFromDB(value: Any) = if (value is PGgeometry) value ...
Read now
Unlock full access