File tree Expand file tree Collapse file tree 4 files changed +21
-59
lines changed
src/Database/PostgreSQL/Query Expand file tree Collapse file tree 4 files changed +21
-59
lines changed Original file line number Diff line number Diff line change 1
1
module Database.PostgreSQL.Query.TH
2
- ( -- * Deriving instances
3
- deriveFromRow
4
- , deriveToRow
5
- , deriveEntity
6
- , deriveEverything
7
- , EntityOptions (.. )
8
- -- * Sql string interpolation
9
- , sqlExp
10
- , sqlExpEmbed
11
- , sqlExpFile
2
+ ( -- * Deriving instances
3
+ deriveEverything
12
4
13
- , module Database.PostgreSQL.Query.TH.Enum
14
- ) where
5
+ , module Database.PostgreSQL.Query.TH.Entity
6
+ , module Database.PostgreSQL.Query.TH.Enum
7
+ , module Database.PostgreSQL.Query.TH.Row
8
+ , module Database.PostgreSQL.Query.TH.SqlExp
9
+ ) where
15
10
16
11
import Prelude
17
12
18
- import Control.Applicative
19
- import Control.Monad
20
- import Data.Default
21
- import Data.FileEmbed ( embedFile )
22
- import Data.String
23
- import Database.PostgreSQL.Query.Entity ( Entity (.. ) )
24
13
import Database.PostgreSQL.Query.TH.Entity
25
14
import Database.PostgreSQL.Query.TH.Enum
26
15
import Database.PostgreSQL.Query.TH.Row
27
16
import Database.PostgreSQL.Query.TH.SqlExp
28
- import Database.PostgreSQL.Query.Types ( FN (.. ) )
29
- import Database.PostgreSQL.Simple.FromRow ( FromRow (.. ), field )
30
- import Database.PostgreSQL.Simple.ToRow ( ToRow (.. ) )
31
- import Database.PostgreSQL.Simple.Types ( Query (.. ) )
32
17
import Language.Haskell.TH
33
- import Language.Haskell.TH.Syntax
34
-
35
-
36
18
37
19
{- | Calls sequently `deriveFromRow` `deriveToRow` `deriveEntity`. E.g. code like this:
38
20
Original file line number Diff line number Diff line change 1
- module Database.PostgreSQL.Query.TH.Common where
1
+ module Database.PostgreSQL.Query.TH.Common
2
+ ( cName
3
+ , cArgs
4
+ , cFieldNames
5
+ , lookupVNameErr
6
+ ) where
2
7
3
8
import Prelude
4
9
5
- import Control.Applicative
6
- import Control.Monad
7
- import Data.Default
8
- import Data.FileEmbed ( embedFile )
9
- import Data.String
10
- import Database.PostgreSQL.Query.Entity ( Entity (.. ) )
11
- import Database.PostgreSQL.Query.Types ( FN (.. ) )
12
- import Database.PostgreSQL.Simple.FromRow ( FromRow (.. ), field )
13
- import Database.PostgreSQL.Simple.ToRow ( ToRow (.. ) )
14
- import Database.PostgreSQL.Simple.Types ( Query (.. ) )
15
10
import Language.Haskell.TH
16
- import Language.Haskell.TH.Syntax
17
11
18
12
-- | Return constructor name
19
13
cName :: (Monad m ) => Con -> m Name
Original file line number Diff line number Diff line change 1
- module Database.PostgreSQL.Query.TH.Entity where
1
+ module Database.PostgreSQL.Query.TH.Entity
2
+ ( EntityOptions (.. )
3
+ , deriveEntity
4
+ ) where
2
5
3
6
import Prelude
4
7
5
- import Database.PostgreSQL.Query.TH.Enum
6
-
7
- import Control.Applicative
8
- import Control.Monad
9
8
import Data.Default
10
- import Data.FileEmbed ( embedFile )
11
9
import Data.String
12
10
import Database.PostgreSQL.Query.Entity ( Entity (.. ) )
13
11
import Database.PostgreSQL.Query.TH.Common
14
12
import Database.PostgreSQL.Query.Types ( FN (.. ) )
15
- import Database.PostgreSQL.Simple.FromRow ( FromRow (.. ), field )
16
- import Database.PostgreSQL.Simple.ToRow ( ToRow (.. ) )
17
- import Database.PostgreSQL.Simple.Types ( Query (.. ) )
18
13
import Language.Haskell.TH
19
14
import Language.Haskell.TH.Syntax
20
15
21
-
22
16
-- | Options for deriving `Entity`
23
17
data EntityOptions = EntityOptions
24
18
{ eoTableName :: String -> String -- ^ Type name to table name converter
Original file line number Diff line number Diff line change 1
- module Database.PostgreSQL.Query.TH.Row where
1
+ module Database.PostgreSQL.Query.TH.Row
2
+ ( deriveFromRow
3
+ , deriveToRow
4
+ ) where
2
5
3
6
import Prelude
4
7
5
- import Database.PostgreSQL.Query.TH.Enum
6
-
7
- import Control.Applicative
8
- import Control.Monad
9
- import Data.Default
10
- import Data.FileEmbed ( embedFile )
11
- import Data.String
12
- import Database.PostgreSQL.Query.Entity ( Entity (.. ) )
13
8
import Database.PostgreSQL.Query.TH.Common
14
- import Database.PostgreSQL.Query.Types ( FN (.. ) )
15
9
import Database.PostgreSQL.Simple.FromRow ( FromRow (.. ), field )
16
10
import Database.PostgreSQL.Simple.ToRow ( ToRow (.. ) )
17
- import Database.PostgreSQL.Simple.Types ( Query (.. ) )
18
11
import Language.Haskell.TH
19
- import Language.Haskell.TH.Syntax
20
12
21
13
22
14
{-| Derive 'FromRow' instance. i.e. you have type like that
You can’t perform that action at this time.
0 commit comments