Skip to content

Commit 8079e99

Browse files
committed
Merge branch 'release/3.0.0' into production
2 parents 97dcac4 + 6fda88c commit 8079e99

25 files changed

+1090
-858
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ cabal.sandbox.config
55
TAGS
66
cabal.config
77
.stack-work
8+
stack.yaml

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# CHANGELOG
22

3+
## 3.0.0
4+
### Added
5+
* Ability to mask some sensitive query arguments in query logs. In case you dont
6+
want someone can see your secret data in logs.
7+
* Added interpolation syntax `#?{argumentExpression}` for masked parameters
8+
* Added `pgQueryWithMasker` and `pgExecuteWithMasker` for custom log masker
9+
* `MonadPostgres` type synonim
10+
### Changed
11+
* Refactoring of `SqlBuilder` and `Entity` modules
12+
* Some low-level intefaces changed
313
## 2.3.0
414
### Added
515
* `derivePgEnum` TH generator for enum fields

lts-2.9.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
flags: {}
2+
extra-package-dbs: []
3+
packages:
4+
- '.'
5+
extra-deps:
6+
- hreader-1.0.2
7+
- hset-2.2.0
8+
- inflections-0.2.0.0
9+
- th-lift-instances-0.1.6
10+
- type-fun-0.1.0
11+
resolver: lts-2.9

stack.yaml renamed to lts-6.7.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ extra-deps:
66
- hreader-1.0.2
77
- hset-2.2.0
88
- th-lift-instances-0.1.6
9-
- type-fun-0.0.1
10-
resolver: lts-3.20
9+
- type-fun-0.1.0
10+
resolver: lts-6.7

postgresql-query.cabal

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: postgresql-query
2-
version: 2.3.0
2+
version: 3.0.0
33

44
synopsis: Sql interpolating quasiquote plus some kind of primitive ORM
55
using it
@@ -25,9 +25,15 @@ library
2525

2626
exposed-modules: Database.PostgreSQL.Query
2727
, Database.PostgreSQL.Query.Entity
28+
, Database.PostgreSQL.Query.Entity.Class
29+
, Database.PostgreSQL.Query.Entity.Functions
30+
, Database.PostgreSQL.Query.Entity.Internal
2831
, Database.PostgreSQL.Query.Functions
2932
, Database.PostgreSQL.Query.Internal
3033
, Database.PostgreSQL.Query.SqlBuilder
34+
, Database.PostgreSQL.Query.SqlBuilder.Builder
35+
, Database.PostgreSQL.Query.SqlBuilder.Class
36+
, Database.PostgreSQL.Query.SqlBuilder.Types
3137
, Database.PostgreSQL.Query.TH
3238
, Database.PostgreSQL.Query.TH.Common
3339
, Database.PostgreSQL.Query.TH.Entity
@@ -36,18 +42,20 @@ library
3642
, Database.PostgreSQL.Query.TH.SqlExp
3743
, Database.PostgreSQL.Query.Types
3844

39-
default-extensions: CPP
45+
default-extensions: AutoDeriveTypeable
46+
, CPP
47+
, ConstraintKinds
48+
, DataKinds
4049
, DeriveDataTypeable
4150
, DeriveGeneric
4251
, EmptyDataDecls
4352
, FlexibleContexts
4453
, FlexibleInstances
54+
, FunctionalDependencies
4555
, GADTs
4656
, GeneralizedNewtypeDeriving
4757
, LambdaCase
4858
, MultiParamTypeClasses
49-
, NoImplicitPrelude
50-
, NoMonomorphismRestriction
5159
, OverloadedStrings
5260
, QuasiQuotes
5361
, RecordWildCards
@@ -88,6 +96,7 @@ library
8896
, transformers
8997
, transformers-base
9098
, transformers-compat >= 0.3
99+
, type-fun >= 0.1.0
91100

92101
ghc-options: -Wall
93102

@@ -100,15 +109,21 @@ test-suite test
100109
ghc-options: -Wall
101110
hs-source-dirs: test
102111
main-is: Main.hs
112+
other-modules: BuilderTest
113+
, ParserTest
103114

104-
default-extensions: FlexibleInstances
115+
default-extensions: CPP
116+
, FlexibleInstances
105117
, OverloadedStrings
118+
, QuasiQuotes
106119
, TemplateHaskell
107120

108121
build-depends: QuickCheck
109122
, attoparsec
110123
, base >=4.6 && < 5
124+
, derive
111125
, postgresql-query
126+
, postgresql-simple
112127
, quickcheck-assertions
113128
, quickcheck-instances
114129
, tasty
@@ -124,7 +139,8 @@ test-suite example
124139
hs-source-dirs: example
125140
main-is: Main.hs
126141

127-
default-extensions: FlexibleInstances
142+
default-extensions: AutoDeriveTypeable
143+
, FlexibleInstances
128144
, OverloadedStrings
129145
, TemplateHaskell
130146

src/Database/PostgreSQL/Query.hs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module Database.PostgreSQL.Query
1212
, FromRow(..), Query(..), Only(..), In(..), Oid(..), Values(..)
1313
, (:.)(..), PGArray(..), HStoreList(..), HStoreMap(..)
1414
, ToHStore(..), HStoreBuilder , hstore, parseHStoreList
15-
, ToHStoreText(..), HStoreText , sqlQQ
15+
, ToHStoreText(..), HStoreText
1616
) where
1717

1818

@@ -23,19 +23,12 @@ import Database.PostgreSQL.Simple.FromField ( FromField(..) )
2323
import Database.PostgreSQL.Simple.FromRow ( FromRow(..) )
2424
import Database.PostgreSQL.Simple.HStore hiding
2525
( toBuilder, toLazyByteString ) -- to prevent conflicts
26-
import Database.PostgreSQL.Simple.SqlQQ
2726
import Database.PostgreSQL.Simple.ToField ( ToField(..) )
2827
import Database.PostgreSQL.Simple.ToRow ( ToRow(..) )
2928
import Database.PostgreSQL.Simple.Types
30-
import Language.Haskell.TH.Quote ( QuasiQuoter )
3129

3230
import Database.PostgreSQL.Query.Entity
3331
import Database.PostgreSQL.Query.Functions
3432
import Database.PostgreSQL.Query.SqlBuilder
3533
import Database.PostgreSQL.Query.TH
3634
import Database.PostgreSQL.Query.Types
37-
38-
sqlQQ :: QuasiQuoter
39-
sqlQQ = sql
40-
41-
{-# DEPRECATED sqlQQ "Use 'sqlExp' instead" #-}
Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,9 @@
11
module Database.PostgreSQL.Query.Entity
2-
( Entity(..)
3-
, Ent
4-
) where
5-
6-
import Data.Proxy
7-
import Data.Text ( Text )
8-
import Data.Typeable ( Typeable )
9-
import Database.PostgreSQL.Query.Types
10-
11-
-- | Auxiliary typeclass for data types which can map to rows of some
12-
-- table. This typeclass is used inside functions like 'pgSelectEntities' to
13-
-- generate queries.
14-
class Entity a where
15-
-- | Id type for this entity
16-
data EntityId a :: *
17-
-- | Table name of this entity
18-
tableName :: Proxy a -> FN
19-
-- | Field names without 'id' and 'created'. The order of field names must match
20-
-- with order of fields in 'ToRow' and 'FromRow' instances of this type.
21-
fieldNames :: Proxy a -> [FN]
22-
23-
deriving instance Typeable EntityId
24-
25-
-- | Entity with it's id
26-
type Ent a = (EntityId a, a)
2+
( module Database.PostgreSQL.Query.Entity.Class
3+
, module Database.PostgreSQL.Query.Entity.Functions
4+
, module Database.PostgreSQL.Query.Entity.Internal
5+
) where
6+
7+
import Database.PostgreSQL.Query.Entity.Class
8+
import Database.PostgreSQL.Query.Entity.Functions
9+
import Database.PostgreSQL.Query.Entity.Internal
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
module Database.PostgreSQL.Query.Entity.Class
2+
( Entity(..)
3+
, Ent
4+
) where
5+
6+
import Data.Proxy
7+
import Data.Typeable ( Typeable )
8+
import Database.PostgreSQL.Query.Types
9+
10+
-- | Auxiliary typeclass for data types which can map to rows of some
11+
-- table. This typeclass is used inside functions like 'pgSelectEntities' to
12+
-- generate queries.
13+
class Entity a where
14+
-- | Id type for this entity
15+
data EntityId a :: *
16+
-- | Table name of this entity
17+
tableName :: Proxy a -> FN
18+
-- | Field names without 'id' and 'created'. The order of field names must match
19+
-- with order of fields in 'ToRow' and 'FromRow' instances of this type.
20+
fieldNames :: Proxy a -> [FN]
21+
22+
deriving instance Typeable EntityId
23+
24+
-- | Entity with it's id
25+
type Ent a = (EntityId a, a)

0 commit comments

Comments
 (0)