{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DeriveDataTypeable #-}
module Database.Persist.Sql.Types
( module Database.Persist.Sql.Types
, SqlBackend (..), SqlReadBackend (..), SqlWriteBackend (..)
, Statement (..), LogFunc, InsertSqlResult (..)
, readToUnknown, readToWrite, writeToUnknown
, SqlBackendCanRead, SqlBackendCanWrite, SqlReadT, SqlWriteT, IsSqlBackend
) where
import Control.Exception (Exception)
import Control.Monad.Trans.Resource (ResourceT)
import Control.Monad.Logger (NoLoggingT)
import Control.Monad.Trans.Reader (ReaderT (..))
import Control.Monad.Trans.Writer (WriterT)
import Data.Typeable (Typeable)
import Database.Persist.Types
import Database.Persist.Sql.Types.Internal
import Data.Pool (Pool)
import Data.Text (Text)
type Connection = SqlBackend
{-# DEPRECATED Connection "Please use SqlBackend instead" #-}
data Column = Column
{ cName :: !DBName
, cNull :: !Bool
, cSqlType :: !SqlType
, cDefault :: !(Maybe Text)
, cDefaultConstraintName :: !(Maybe DBName)
, cMaxLen :: !(Maybe Integer)
, cReference :: !(Maybe (DBName, DBName))
}
deriving (Eq, Ord, Show)
data PersistentSqlException = StatementAlreadyFinalized Text
| Couldn'tGetSQLConnection
deriving (Typeable, Show)
instance Exception PersistentSqlException
type SqlPersistT = ReaderT SqlBackend
type SqlPersist = SqlPersistT
{-# DEPRECATED SqlPersist "Please use SqlPersistT instead" #-}
type SqlPersistM = SqlPersistT (NoLoggingT (ResourceT IO))
type Sql = Text
type CautiousMigration = [(Bool, Sql)]
type Migration = WriterT [Text] (WriterT CautiousMigration (ReaderT SqlBackend IO)) ()
type ConnectionPool = Pool SqlBackend
newtype Single a = Single {unSingle :: a}
deriving (Eq, Ord, Show, Read)