Skip to content

Instantly share code, notes, and snippets.

@naderghanbari
Last active December 28, 2019 02:42
Show Gist options
  • Save naderghanbari/e1fca2ea0eb703c94fcf0ebd76436624 to your computer and use it in GitHub Desktop.
Save naderghanbari/e1fca2ea0eb703c94fcf0ebd76436624 to your computer and use it in GitHub Desktop.
Scala, Slick, and PostGIS :: PostGISProfile.scala + SlickSchema.scala
package infra.slick
import com.github.tminglei.slickpg._
trait PostGISProfile extends ExPostgresProfile with PgPostGISSupport {
object ExtendedAPI extends API with PostGISImplicits
override val api = ExtendedAPI
}
object PostGISProfile extends PostGISProfile
package infra.slick
import java.util.UUID
import domain.Building
import org.locationtech.jts.geom.Point
import PostGISProfile.api._
trait SlickSchema {
class BuildingsTable(tag: Tag) extends Table[Building](tag, "buildings") {
def id = column[UUID]("id", O.PrimaryKey)
def name = column[String]("name")
def coordinate = column[Point]("coordinate")
def * = (id, name, coordinate) <> (Building.tupled, Building.unapply)
}
val Buildings = TableQuery[BuildingsTable]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment