packages feed

postgresql-query 3.0.1 → 3.1.0

raw patch · 4 files changed

+25/−5 lines, 4 filesdep ~inflections

Dependency ranges changed: inflections

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # CHANGELOG +## 3.1.0+### Changed+* Support for inflections-0.3 (fixed buildability). Tested with LTS 8.5+ ## 3.0.1 ### Changed * Buildability with ghc-8.0.1
example/Main.hs view
@@ -1,9 +1,9 @@ module Main where +import Data.Char import Data.Text (Text) import Data.Time import Database.PostgreSQL.Query-import Text.Inflections  -- | Example enum type to check out how 'derivePgEnum' works data Species@@ -11,7 +11,7 @@   | Cat   | Snake -derivePgEnum toUnderscore ''Species+derivePgEnum (map toLower) ''Species  -- | Example structure to check out how 'deriveFromRow' works data AnimalInfo = AnimalInfo
postgresql-query.cabal view
@@ -1,5 +1,5 @@ name:                postgresql-query-version:             3.0.1+version:             3.1.0  synopsis: Sql interpolating quasiquote plus some kind of primitive ORM           using it@@ -81,7 +81,7 @@                , haskell-src-meta                , hreader                       >= 1.0.0   && < 2.0.0                , hset                          >= 2.0.0   && < 3.0.0-               , inflections                   >= 0.2     && < 0.3+               , inflections                   >= 0.2     && < 0.4                , monad-control                 == 0.3.3.1 || > 1.0.0.3                , monad-logger                , mtl@@ -145,7 +145,6 @@                     , TemplateHaskell    build-depends: base-               , inflections                , postgresql-query                , text                , time
src/Database/PostgreSQL/Query/TH/Entity.hs view
@@ -7,6 +7,7 @@  import Data.Default import Data.String+import Data.Text (pack, unpack) import Database.PostgreSQL.Query.Entity.Class import Database.PostgreSQL.Query.TH.Common import Database.PostgreSQL.Query.Types ( FN(..) )@@ -29,6 +30,7 @@     , eoIdType         :: Name             -- ^ Base type for Id     } deriving (Generic) +#if !MIN_VERSION_inflections(0,3,0) instance Default EntityOptions where   def = EntityOptions         { eoTableName     = toUnderscore@@ -37,6 +39,21 @@                             , ''FromField, ''ToField ]         , eoIdType        = ''Integer         }+#else+instance Default EntityOptions where+  def = EntityOptions+        { eoTableName     = toUnderscore'+        , eoColumnNames   = toUnderscore'+        , eoDeriveClasses = [ ''Ord, ''Eq, ''Show+                            , ''FromField, ''ToField ]+        , eoIdType        = ''Integer+        }++toUnderscore' :: String -> String+toUnderscore' s = case toUnderscore $ pack s of+  Left er -> error $ "toUnderscore: " ++ show er+  Right a -> unpack a+#endif  {- | Derives instance for 'Entity' using type name and field names. Also generates type synonim for ID. E.g. code like this: