packages feed

postgresql-orm 0.4.1 → 0.5.0

raw patch · 4 files changed

+41/−14 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Data.RequireSelector: instance Data.RequireSelector.IntentionallyCauseError GHC.Generics.NoSelector => Data.RequireSelector.RequireSelector GHC.Generics.NoSelector
- Database.PostgreSQL.ORM.DBSelect: instance GHC.Generics.Constructor Database.PostgreSQL.ORM.DBSelect.C1_0DBSelect
- Database.PostgreSQL.ORM.DBSelect: instance GHC.Generics.Datatype Database.PostgreSQL.ORM.DBSelect.D1DBSelect
- Database.PostgreSQL.ORM.DBSelect: instance GHC.Generics.Selector Database.PostgreSQL.ORM.DBSelect.S1_0_0DBSelect
- Database.PostgreSQL.ORM.DBSelect: instance GHC.Generics.Selector Database.PostgreSQL.ORM.DBSelect.S1_0_10DBSelect
- Database.PostgreSQL.ORM.DBSelect: instance GHC.Generics.Selector Database.PostgreSQL.ORM.DBSelect.S1_0_1DBSelect
- Database.PostgreSQL.ORM.DBSelect: instance GHC.Generics.Selector Database.PostgreSQL.ORM.DBSelect.S1_0_2DBSelect
- Database.PostgreSQL.ORM.DBSelect: instance GHC.Generics.Selector Database.PostgreSQL.ORM.DBSelect.S1_0_3DBSelect
- Database.PostgreSQL.ORM.DBSelect: instance GHC.Generics.Selector Database.PostgreSQL.ORM.DBSelect.S1_0_4DBSelect
- Database.PostgreSQL.ORM.DBSelect: instance GHC.Generics.Selector Database.PostgreSQL.ORM.DBSelect.S1_0_5DBSelect
- Database.PostgreSQL.ORM.DBSelect: instance GHC.Generics.Selector Database.PostgreSQL.ORM.DBSelect.S1_0_6DBSelect
- Database.PostgreSQL.ORM.DBSelect: instance GHC.Generics.Selector Database.PostgreSQL.ORM.DBSelect.S1_0_7DBSelect
- Database.PostgreSQL.ORM.DBSelect: instance GHC.Generics.Selector Database.PostgreSQL.ORM.DBSelect.S1_0_8DBSelect
- Database.PostgreSQL.ORM.DBSelect: instance GHC.Generics.Selector Database.PostgreSQL.ORM.DBSelect.S1_0_9DBSelect
- Database.PostgreSQL.ORM.Model: instance (Data.Data.Data reftype, Data.Data.Data table) => Data.Data.Data (Database.PostgreSQL.ORM.Model.GDBRef reftype table)
- Database.PostgreSQL.ORM.Model: instance (GHC.Generics.Selector c, Data.RequireSelector.RequireSelector c) => Database.PostgreSQL.ORM.Model.GColumns (GHC.Generics.M1 GHC.Generics.S c f)
- Database.PostgreSQL.ORM.Model: instance Data.Aeson.Types.Class.FromJSON (Database.PostgreSQL.ORM.Model.GDBRef t a)
- Database.PostgreSQL.ORM.Model: instance Data.Aeson.Types.Class.FromJSON Database.PostgreSQL.ORM.Model.DBKey
- Database.PostgreSQL.ORM.Model: instance Data.Aeson.Types.Class.ToJSON (Database.PostgreSQL.ORM.Model.GDBRef t a)
- Database.PostgreSQL.ORM.Model: instance Data.Aeson.Types.Class.ToJSON Database.PostgreSQL.ORM.Model.DBKey
- Database.PostgreSQL.ORM.Model: instance Data.RequireSelector.RequireSelector c => Database.PostgreSQL.ORM.Model.GPrimaryKey0 (GHC.Generics.S1 c (GHC.Generics.K1 i Database.PostgreSQL.ORM.Model.DBKey))
- Database.PostgreSQL.ORM.Model: instance GHC.Generics.Constructor Database.PostgreSQL.ORM.Model.C1_0DBKey
- Database.PostgreSQL.ORM.Model: instance GHC.Generics.Constructor Database.PostgreSQL.ORM.Model.C1_0GDBRef
- Database.PostgreSQL.ORM.Model: instance GHC.Generics.Constructor Database.PostgreSQL.ORM.Model.C1_1DBKey
- Database.PostgreSQL.ORM.Model: instance GHC.Generics.Datatype Database.PostgreSQL.ORM.Model.D1DBKey
- Database.PostgreSQL.ORM.Model: instance GHC.Generics.Datatype Database.PostgreSQL.ORM.Model.D1GDBRef
- Database.PostgreSQL.ORM.SqlType: instance Database.PostgreSQL.ORM.SqlType.SqlType Data.Time.Clock.UTC.UTCTime
- Database.PostgreSQL.ORM.SqlType: instance Database.PostgreSQL.ORM.SqlType.SqlType Data.Time.LocalTime.LocalTime.LocalTime
- Database.PostgreSQL.ORM.SqlType: instance Database.PostgreSQL.ORM.SqlType.SqlType Data.Time.LocalTime.LocalTime.ZonedTime
- Database.PostgreSQL.ORM.SqlType: instance Database.PostgreSQL.ORM.SqlType.SqlType Data.Time.LocalTime.TimeOfDay.TimeOfDay
- Database.PostgreSQL.ORM.Validations: instance Data.Aeson.Types.Class.FromJSON Database.PostgreSQL.ORM.Validations.ValidationError
- Database.PostgreSQL.ORM.Validations: instance Data.Aeson.Types.Class.ToJSON Database.PostgreSQL.ORM.Validations.ValidationError
+ Database.PostgreSQL.ORM.Model: instance (Data.Data.Data table, Data.Data.Data reftype) => Data.Data.Data (Database.PostgreSQL.ORM.Model.GDBRef reftype table)
+ Database.PostgreSQL.ORM.Model: instance Data.Aeson.Types.FromJSON.FromJSON (Database.PostgreSQL.ORM.Model.GDBRef t a)
+ Database.PostgreSQL.ORM.Model: instance Data.Aeson.Types.FromJSON.FromJSON Database.PostgreSQL.ORM.Model.DBKey
+ Database.PostgreSQL.ORM.Model: instance Data.Aeson.Types.ToJSON.ToJSON (Database.PostgreSQL.ORM.Model.GDBRef t a)
+ Database.PostgreSQL.ORM.Model: instance Data.Aeson.Types.ToJSON.ToJSON Database.PostgreSQL.ORM.Model.DBKey
+ Database.PostgreSQL.ORM.Model: instance Database.PostgreSQL.ORM.Model.GPrimaryKey0 (GHC.Generics.S1 c (GHC.Generics.K1 i Database.PostgreSQL.ORM.Model.DBKey))
+ Database.PostgreSQL.ORM.Model: instance GHC.Generics.Selector c => Database.PostgreSQL.ORM.Model.GColumns (GHC.Generics.M1 GHC.Generics.S c f)
+ Database.PostgreSQL.ORM.SqlType: instance Database.PostgreSQL.ORM.SqlType.SqlType Data.Time.Clock.Internal.UTCTime.UTCTime
+ Database.PostgreSQL.ORM.SqlType: instance Database.PostgreSQL.ORM.SqlType.SqlType Data.Time.LocalTime.Internal.LocalTime.LocalTime
+ Database.PostgreSQL.ORM.SqlType: instance Database.PostgreSQL.ORM.SqlType.SqlType Data.Time.LocalTime.Internal.TimeOfDay.TimeOfDay
+ Database.PostgreSQL.ORM.SqlType: instance Database.PostgreSQL.ORM.SqlType.SqlType Data.Time.LocalTime.Internal.ZonedTime.ZonedTime
+ Database.PostgreSQL.ORM.Validations: instance Data.Aeson.Types.FromJSON.FromJSON Database.PostgreSQL.ORM.Validations.ValidationError
+ Database.PostgreSQL.ORM.Validations: instance Data.Aeson.Types.ToJSON.ToJSON Database.PostgreSQL.ORM.Validations.ValidationError
- Data.GetField: class Extractor f a r g | f a r -> g where extractCount fr a = gCount (extract fr a)
+ Data.GetField: class Extractor f a r g | f a r -> g
- Data.GetField: extractCount :: Extractor f a r g => f r -> a -> (Int, [Int])
+ Data.GetField: extractCount :: (Extractor f a r g, (GCount g)) => f r -> a -> (Int, [Int])
- Database.PostgreSQL.ORM: class Model a where modelInfo = defaultModelInfo modelIdentifiers = defaultModelIdentifiers modelInfo modelRead = defaultFromRow modelWrite = defaultModelWrite modelQueries = defaultModelQueries modelIdentifiers modelCreateInfo = emptyModelCreateInfo modelValid = const mempty
+ Database.PostgreSQL.ORM: class Model a
- Database.PostgreSQL.ORM: class RowAlias a where rowAliasName _ = fromString $ caseFold $ gUnitTypeName . from $ a where caseFold (h : t) = toLower h : t caseFold [] = [] a = undefined :: a
+ Database.PostgreSQL.ORM: class RowAlias a
- Database.PostgreSQL.ORM: dbrefAssocs :: (Model child, Model parent) => GDBRefInfo rt child parent -> (Association child parent, Association parent child)
+ Database.PostgreSQL.ORM: dbrefAssocs :: forall child parent rt. (Model child, Model parent) => GDBRefInfo rt child parent -> (Association child parent, Association parent child)
- Database.PostgreSQL.ORM: defaultDBRefInfo :: (Model child, Model parent, GetField ExtractRef child (DBRef parent)) => DBRefInfo child parent
+ Database.PostgreSQL.ORM: defaultDBRefInfo :: forall child parent. (Model child, Model parent, GetField ExtractRef child (DBRef parent)) => DBRefInfo child parent
- Database.PostgreSQL.ORM: defaultJoinTable :: (Model a, Model b) => JoinTable a b
+ Database.PostgreSQL.ORM: defaultJoinTable :: forall a b. (Model a, Model b) => JoinTable a b
- Database.PostgreSQL.ORM: defaultModelInfo :: (Generic a, GDatatypeName (Rep a), GColumns (Rep a), GPrimaryKey0 (Rep a)) => ModelInfo a
+ Database.PostgreSQL.ORM: defaultModelInfo :: forall a. (Generic a, GDatatypeName (Rep a), GColumns (Rep a), GPrimaryKey0 (Rep a)) => ModelInfo a
- Database.PostgreSQL.ORM: destroy :: (Model a) => Connection -> a -> IO ()
+ Database.PostgreSQL.ORM: destroy :: forall a. (Model a) => Connection -> a -> IO (Either ValidationError Bool)
- Database.PostgreSQL.ORM: destroyByRef :: (Model a) => Connection -> GDBRef rt a -> IO ()
+ Database.PostgreSQL.ORM: destroyByRef :: forall a rt. (Model a) => Connection -> GDBRef rt a -> IO (Either ValidationError Bool)
- Database.PostgreSQL.ORM: findAll :: (Model r) => Connection -> IO [r]
+ Database.PostgreSQL.ORM: findAll :: forall r. (Model r) => Connection -> IO [r]
- Database.PostgreSQL.ORM: findRow :: (Model r) => Connection -> GDBRef rt r -> IO (Maybe r)
+ Database.PostgreSQL.ORM: findRow :: forall r rt. (Model r) => Connection -> GDBRef rt r -> IO (Maybe r)
- Database.PostgreSQL.ORM: modelDBSelect :: (Model a) => DBSelect a
+ Database.PostgreSQL.ORM: modelDBSelect :: forall a. (Model a) => DBSelect a
- Database.PostgreSQL.ORM: modelInfo :: Model a => ModelInfo a
+ Database.PostgreSQL.ORM: modelInfo :: (Model a, Generic a, GDatatypeName (Rep a), GColumns (Rep a), GPrimaryKey0 (Rep a)) => ModelInfo a
- Database.PostgreSQL.ORM: rowAliasName :: RowAlias a => g a row -> ByteString
+ Database.PostgreSQL.ORM: rowAliasName :: (RowAlias a, Generic a, GUnitType (Rep a)) => g a row -> ByteString
- Database.PostgreSQL.ORM: trySave :: Model r => Connection -> r -> IO (Either ValidationError r)
+ Database.PostgreSQL.ORM: trySave :: forall r. Model r => Connection -> r -> IO (Either ValidationError r)
- Database.PostgreSQL.ORM.Association: dbrefAssocs :: (Model child, Model parent) => GDBRefInfo rt child parent -> (Association child parent, Association parent child)
+ Database.PostgreSQL.ORM.Association: dbrefAssocs :: forall child parent rt. (Model child, Model parent) => GDBRefInfo rt child parent -> (Association child parent, Association parent child)
- Database.PostgreSQL.ORM.Association: defaultDBRefInfo :: (Model child, Model parent, GetField ExtractRef child (DBRef parent)) => DBRefInfo child parent
+ Database.PostgreSQL.ORM.Association: defaultDBRefInfo :: forall child parent. (Model child, Model parent, GetField ExtractRef child (DBRef parent)) => DBRefInfo child parent
- Database.PostgreSQL.ORM.Association: defaultJoinTable :: (Model a, Model b) => JoinTable a b
+ Database.PostgreSQL.ORM.Association: defaultJoinTable :: forall a b. (Model a, Model b) => JoinTable a b
- Database.PostgreSQL.ORM.Association: jtAssoc :: (Model a, Model b) => JoinTable a b -> Association a b
+ Database.PostgreSQL.ORM.Association: jtAssoc :: forall a b. (Model a, Model b) => JoinTable a b -> Association a b
- Database.PostgreSQL.ORM.CreateTable: modelCreateStatement :: (Model a, Generic a, GDefTypes (Rep a)) => a -> Query
+ Database.PostgreSQL.ORM.CreateTable: modelCreateStatement :: forall a. (Model a, Generic a, GDefTypes (Rep a)) => a -> Query
- Database.PostgreSQL.ORM.DBSelect: dbJoin :: (Model a, Model b) => DBSelect a -> Query -> DBSelect b -> Query -> DBSelect (a :. b)
+ Database.PostgreSQL.ORM.DBSelect: dbJoin :: forall a b. (Model a, Model b) => DBSelect a -> Query -> DBSelect b -> Query -> DBSelect (a :. b)
- Database.PostgreSQL.ORM.DBSelect: dbNest :: (Model a, Model b) => DBSelect (a :. b) -> DBSelect (b :. c) -> DBSelect (a :. (b :. c))
+ Database.PostgreSQL.ORM.DBSelect: dbNest :: forall a b c. (Model a, Model b) => DBSelect (a :. b) -> DBSelect (b :. c) -> DBSelect (a :. (b :. c))
- Database.PostgreSQL.ORM.DBSelect: dbProject :: (Model a) => DBSelect something_containing_a -> DBSelect a
+ Database.PostgreSQL.ORM.DBSelect: dbProject :: forall a something_containing_a. (Model a) => DBSelect something_containing_a -> DBSelect a
- Database.PostgreSQL.ORM.DBSelect: dbProject' :: (Model a) => DBSelect something_containing_a -> DBSelect a
+ Database.PostgreSQL.ORM.DBSelect: dbProject' :: forall a something_containing_a. (Model a) => DBSelect something_containing_a -> DBSelect a
- Database.PostgreSQL.ORM.DBSelect: modelDBSelect :: (Model a) => DBSelect a
+ Database.PostgreSQL.ORM.DBSelect: modelDBSelect :: forall a. (Model a) => DBSelect a
- Database.PostgreSQL.ORM.Model: class Model a where modelInfo = defaultModelInfo modelIdentifiers = defaultModelIdentifiers modelInfo modelRead = defaultFromRow modelWrite = defaultModelWrite modelQueries = defaultModelQueries modelIdentifiers modelCreateInfo = emptyModelCreateInfo modelValid = const mempty
+ Database.PostgreSQL.ORM.Model: class Model a
- Database.PostgreSQL.ORM.Model: class RowAlias a where rowAliasName _ = fromString $ caseFold $ gUnitTypeName . from $ a where caseFold (h : t) = toLower h : t caseFold [] = [] a = undefined :: a
+ Database.PostgreSQL.ORM.Model: class RowAlias a
- Database.PostgreSQL.ORM.Model: defaultModelInfo :: (Generic a, GDatatypeName (Rep a), GColumns (Rep a), GPrimaryKey0 (Rep a)) => ModelInfo a
+ Database.PostgreSQL.ORM.Model: defaultModelInfo :: forall a. (Generic a, GDatatypeName (Rep a), GColumns (Rep a), GPrimaryKey0 (Rep a)) => ModelInfo a
- Database.PostgreSQL.ORM.Model: defaultModelWrite :: (Model a, Generic a, GToRow (Rep a)) => a -> [Action]
+ Database.PostgreSQL.ORM.Model: defaultModelWrite :: forall a. (Model a, Generic a, GToRow (Rep a)) => a -> [Action]
- Database.PostgreSQL.ORM.Model: destroy :: (Model a) => Connection -> a -> IO ()
+ Database.PostgreSQL.ORM.Model: destroy :: forall a. (Model a) => Connection -> a -> IO (Either ValidationError Bool)
- Database.PostgreSQL.ORM.Model: destroyByRef :: (Model a) => Connection -> GDBRef rt a -> IO ()
+ Database.PostgreSQL.ORM.Model: destroyByRef :: forall a rt. (Model a) => Connection -> GDBRef rt a -> IO (Either ValidationError Bool)
- Database.PostgreSQL.ORM.Model: findAll :: (Model r) => Connection -> IO [r]
+ Database.PostgreSQL.ORM.Model: findAll :: forall r. (Model r) => Connection -> IO [r]
- Database.PostgreSQL.ORM.Model: findRow :: (Model r) => Connection -> GDBRef rt r -> IO (Maybe r)
+ Database.PostgreSQL.ORM.Model: findRow :: forall r rt. (Model r) => Connection -> GDBRef rt r -> IO (Maybe r)
- Database.PostgreSQL.ORM.Model: modelInfo :: Model a => ModelInfo a
+ Database.PostgreSQL.ORM.Model: modelInfo :: (Model a, Generic a, GDatatypeName (Rep a), GColumns (Rep a), GPrimaryKey0 (Rep a)) => ModelInfo a
- Database.PostgreSQL.ORM.Model: modelName :: (Model a) => a -> ByteString
+ Database.PostgreSQL.ORM.Model: modelName :: forall a. (Model a) => a -> ByteString
- Database.PostgreSQL.ORM.Model: modelRead :: Model a => RowParser a
+ Database.PostgreSQL.ORM.Model: modelRead :: (Model a, Generic a, GFromRow (Rep a)) => RowParser a
- Database.PostgreSQL.ORM.Model: modelWrite :: Model a => a -> [Action]
+ Database.PostgreSQL.ORM.Model: modelWrite :: (Model a, Generic a, GToRow (Rep a)) => a -> [Action]
- Database.PostgreSQL.ORM.Model: rowAliasName :: RowAlias a => g a row -> ByteString
+ Database.PostgreSQL.ORM.Model: rowAliasName :: (RowAlias a, Generic a, GUnitType (Rep a)) => g a row -> ByteString
- Database.PostgreSQL.ORM.Model: trySave :: Model r => Connection -> r -> IO (Either ValidationError r)
+ Database.PostgreSQL.ORM.Model: trySave :: forall r. Model r => Connection -> r -> IO (Either ValidationError r)
- Database.PostgreSQL.ORM.SqlType: class (ToField a, FromField a) => SqlType a where sqlType _ = (sqlBaseType (undefined :: a)) <> " NOT NULL"
+ Database.PostgreSQL.ORM.SqlType: class (ToField a, FromField a) => SqlType a

Files

Data/GetField.hs view
@@ -8,6 +8,9 @@ #if __GLASGOW_HASKELL__ < 710 {-# LANGUAGE OverlappingInstances #-} #endif+{-# LANGUAGE RankNTypes #-}+{-# LANGUAGE AllowAmbiguousTypes #-}+-- ^ Enables the default implementation of Extractor as of GHC 8.0 {-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} 
Data/RequireSelector.hs view
@@ -1,12 +1,14 @@-{-# LANGUAGE FlexibleInstances, UndecidableInstances #-}+{-# LANGUAGE FlexibleInstances, UndecidableInstances, CPP #-}  module Data.RequireSelector (RequireSelector) where +#if defined(__GLASGOW_HASKELL__) && (__GLASGOW_HASKELL__ < 800) import GHC.Generics  -- | There are intentionally no members of this class, so that placing -- it in a context will always cause an error. class IntentionallyCauseError a+#endif  -- | The point of this class is to ensure that you are using data -- types defined with record selectors (i.e., @data Foo = Foo { unFoo@@ -20,5 +22,7 @@ -- @IntentionallyCauseError@, it means you failed to define one of -- your datatypes using record selector syntax. class RequireSelector a+#if defined(__GLASGOW_HASKELL__) && (__GLASGOW_HASKELL__ < 800) instance (IntentionallyCauseError NoSelector) => RequireSelector NoSelector+#endif instance RequireSelector a
Database/PostgreSQL/ORM/Model.hs view
@@ -111,6 +111,8 @@ import qualified Data.Aeson as A import qualified Data.ByteString as S import qualified Data.ByteString.Char8 as S8+import qualified Data.Text as T+import qualified Data.Text.Encoding as T import Data.Char import Data.Data import Data.Int@@ -336,7 +338,7 @@   gColumns :: f p -> [S.ByteString] instance GColumns U1 where   gColumns _ = []-instance (Selector c, RequireSelector c) => GColumns (M1 S c f) where+instance (Selector c) => GColumns (M1 S c f) where   gColumns s = [fromString $ selName s] instance (GColumns a, GColumns b) => GColumns (a :*: b) where   gColumns ~(a :*: b) = gColumns a ++ gColumns b@@ -353,7 +355,7 @@ -- of this class, then move the 'DBKey' first in your data structure. class GPrimaryKey0 f where   gPrimaryKey0 :: f p -> DBKey-instance (RequireSelector c) => GPrimaryKey0 (S1 c (K1 i DBKey)) where+instance GPrimaryKey0 (S1 c (K1 i DBKey)) where   {-# INLINE gPrimaryKey0 #-}   gPrimaryKey0 (M1 (K1 k)) = k instance (GPrimaryKey0 a) => GPrimaryKey0 (a :*: b) where@@ -603,6 +605,7 @@     "UPDATE ", modelQTable mi, " SET "     , S.intercalate ", " $ map (<> " = ?") $ modelQWriteColumns mi     , " WHERE ", modelQPrimaryColumn mi, " = ?"+    , " RETURNING ", S.intercalate ", " (modelQColumns mi)   ]  -- | Default SQL insert query for a model.@@ -1119,10 +1122,11 @@                   case rs of [r'] -> return $ Right $ lookupRow r'                              _    -> fail "save: database did not return row"             | otherwise = do-                  n <- execute c (modelUpdateQuery qs) (UpdateRow r)-                  case n of 1 -> return $ Right r-                            _ -> fail $ "save: database updated " ++ show n-                                        ++ " records"+                  rows <- query c (modelUpdateQuery qs) (UpdateRow r)+                  case rows of [r'] -> return $ Right $ lookupRow r'+                               _     -> fail $ "save: database updated "+                                          ++ show (length rows)+                                          ++ " records"   where qs = modelQueries :: ModelQueries r         errors = modelValid r @@ -1130,17 +1134,33 @@ -- the database.  This function only looks at the primary key in the -- data structure.  It is an error to call this function if the -- primary key is not set.-destroy :: forall a. (Model a) => Connection -> a -> IO ()+destroy :: forall a. (Model a)+  => Connection -> a -> IO (Either ValidationError Bool) destroy c a =   case primaryKey a of     NullKey -> fail "destroy: NullKey"-    DBKey k -> void $ execute c-               (modelDeleteQuery (modelQueries :: ModelQueries a)) (Only k)+    DBKey k -> destroyByRef_ "destroy" c (DBRef k :: DBRef a)  -- | Remove a row from the database without fetching it first.-destroyByRef :: forall a rt. (Model a) => Connection -> GDBRef rt a -> IO ()-destroyByRef c a =-  void $ execute c (modelDeleteQuery (modelQueries :: ModelQueries a)) (Only a)+destroyByRef :: forall a rt. (Model a)+  => Connection -> GDBRef rt a -> IO (Either ValidationError Bool)+destroyByRef = destroyByRef_ "destroyByRef"++destroyByRef_ :: forall a rt. (Model a)+  => T.Text -> Connection -> GDBRef rt a -> IO (Either ValidationError Bool)+destroyByRef_ msg c a = action+  where mq     = modelQueries     :: ModelQueries a+        mi     = modelIdentifiers :: ModelIdentifiers a+        pkCol  = modelQPrimaryColumn mi+        action = do+            n <- execute c (modelDeleteQuery mq) (Only a)+            return $ case n of+                0 -> Right False+                1 -> Right True+                _ -> Left $ validationError (T.decodeUtf8 pkCol) $+                    msg <> ": DELETE modified " <> T.pack (show n) <>+                    " rows. This may indicate that your primary key" <>+                    " accessor field is not actually a primary key."  -- | Print to stdout the query statement. printq :: Query -> IO ()
postgresql-orm.cabal view
@@ -1,5 +1,5 @@ name: postgresql-orm-version: 0.4.1+version: 0.5.0 cabal-version: >= 1.14 build-type: Simple license: GPL