Skip to content

Commit

Permalink
Drop usage of removed Esqueleto class
Browse files Browse the repository at this point in the history
  • Loading branch information
tysonzero committed Mar 21, 2020
1 parent 864905b commit c3dfd7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions esqueleto-postgis.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: esqueleto-postgis
version: 1.2.0.0
version: 1.3.0.0
build-type: Simple
cabal-version: >=1.10

Expand All @@ -8,7 +8,7 @@ library
ghc-options: -O2 -Wall
default-language: Haskell2010
build-depends: base >=4.12.0 && <4.13
, esqueleto >=2.6.0 && <2.7
, esqueleto >=2.6.0 && <2.8 || >=3.0.0 && <3.4
, geos >=0.2.2 && <0.3
, persistent-postgis >=1.2.0 && <1.3
exposed-modules: Database.Esqueleto.Postgis.Geography
11 changes: 4 additions & 7 deletions src/Database/Esqueleto/Postgis/Geography.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,18 @@

module Database.Esqueleto.Postgis.Geography (intersects) where

import Database.Esqueleto (Esqueleto, SqlBackend, SqlExpr, SqlQuery, Value)
import Database.Esqueleto (SqlExpr, Value)
import Database.Esqueleto.Internal.Sql (unsafeSqlFunction)
import Data.Geometry.Geos.Geometry (Some)
import Database.Persist.Postgis.Geography (Geography)


class IsGeography g
instance IsGeography (Geography a)
instance IsGeography (Some Geography)
instance IsGeography a => IsGeography (Maybe a)

class Esqueleto query expr backend => EsqueletoGeography query expr backend where
intersects :: (IsGeography a, IsGeography b)
=> expr (Value a) -> expr (Value b) -> expr (Value Bool)
intersects :: (IsGeography a, IsGeography b)
=> SqlExpr (Value a) -> SqlExpr (Value b) -> SqlExpr (Value Bool)
intersects a b = unsafeSqlFunction "ST_Intersects" (a, b)
infixl 7 `intersects`

instance EsqueletoGeography SqlQuery SqlExpr SqlBackend where
intersects a b = unsafeSqlFunction "ST_Intersects" (a, b)

0 comments on commit c3dfd7c

Please sign in to comment.