on dev help sign in
some docs and cabal
commit9c27c8b3ddf325450cf1ff177b5bf4895e1aad5b authorEitan Chatav <eitan.chatav@gmail.com> dateSat 4 Aug 2018, 01:53 (8 years ago) parent7802ae6
6 files changed+17−2
RELEASE NOTES.md+5 squeal-postgresql/squeal-postgresql.cabal+1−1 squeal-postgresql/src/Squeal/PostgreSQL/Expression.hs+1 squeal-postgresql/src/Squeal/PostgreSQL/Query.hs+4 squeal-postgresql/src/Squeal/PostgreSQL/Render.hs+2 squeal-postgresql/src/Squeal/PostgreSQL/Schema.hs+4−1
RELEASE NOTES.md+5
@@ -1,5 +1,10 @@
11## RELEASE NOTES
22
3+### Version 0.3.2 - August 4, 2018
4+
5+Version 0.3.2 features extensive support for `JSON` functionality.
6+This work is entirely due to [Mike Ledger](https://github.com/mikeplus64).
7+
38### Version 0.3.1 - July 7, 2018
49
510Version 0.3.1 of Squeal enables the "Scrap your Nils" trick for
squeal-postgresql/squeal-postgresql.cabal+1−1
@@ -1,5 +1,5 @@
11name: squeal-postgresql
2−version: 0.3.1.0
2+version: 0.3.2.0
33synopsis: Squeal PostgreSQL Library
44description: Squeal is a type-safe embedding of PostgreSQL in Haskell
55homepage: https://github.com/morphismtech/squeal
squeal-postgresql/src/Squeal/PostgreSQL/Expression.hs+1
@@ -529,6 +529,7 @@ unsafeFunction
529529unsafeFunction fun x = UnsafeExpression $
530530 fun <> parenthesized (renderExpression x)
531531
532+-- | Helper for defining variadic functions.
532533unsafeVariadicFunction
533534 :: SListI elems
534535 => ByteString
squeal-postgresql/src/Squeal/PostgreSQL/Query.hs+4
@@ -651,9 +651,13 @@ JSON stuff
651651type PGjson_each_variant val tab =
652652 '[ tab ::: '[ "key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull val ] ]
653653
654+-- | The type of a `json_each` `FromClause`.
654655type PGjson_each tab = PGjson_each_variant 'PGjson tab
656+-- | The type of a `jsonb_each` `FromClause`.
655657type PGjsonb_each tab = PGjson_each_variant 'PGjsonb tab
658+-- | The type of a `json_each_text` `FromClause`.
656659type PGjson_each_text tab = PGjson_each_variant 'PGtext tab
660+-- | The type of a `jsonb_each_text` `FromClause`.
657661type PGjsonb_each_text tab = PGjson_each_variant 'PGtext tab
658662
659663unsafeAliasedFromClauseExpression
squeal-postgresql/src/Squeal/PostgreSQL/Render.hs+2
@@ -61,9 +61,11 @@ commaSeparated = ByteString.intercalate ", "
6161doubleQuoted :: ByteString -> ByteString
6262doubleQuoted str = "\"" <> str <> "\""
6363
64+-- | Add single quotes around a `Text` and escape single quotes within it.
6465singleQuotedText :: Text -> ByteString
6566singleQuotedText str = "'" <> T.encodeUtf8 (T.replace "'" "''" str) <> "'"
6667
68+-- | Add single quotes around a `ByteString` and escape single quotes within it.
6769singleQuotedUtf8 :: ByteString -> ByteString
6870singleQuotedUtf8 = singleQuotedText . T.decodeUtf8
6971
squeal-postgresql/src/Squeal/PostgreSQL/Schema.hs+4−1
@@ -380,6 +380,8 @@ instance KnownSymbol alias => RenderSQL (Alias alias) where renderSQL = renderAl
380380renderAlias :: KnownSymbol alias => Alias alias -> ByteString
381381renderAlias = doubleQuoted . fromString . symbolVal
382382
383+-- | >>> renderAliasString #ohmahgerd
384+-- "'ohmahgerd'"
383385renderAliasString :: KnownSymbol alias => Alias alias -> ByteString
384386renderAliasString = singleQuotedText . fromString . symbolVal
385387
@@ -616,11 +618,12 @@ type family NullifyRelations (tables :: RelationsType) :: RelationsType where
616618 NullifyRelations (table ::: columns ': tables) =
617619 table ::: NullifyRelation columns ': NullifyRelations tables
618620
619−-- | 'RelationToRowType' drops the nullity constraints of its argument relations.
621+-- | `RelationToRowType` drops the nullity constraints of its argument relations.
620622type family RelationToRowType (tables :: RelationType) :: [(Symbol, PGType)] where
621623 RelationToRowType (nullity x : xs) = x : RelationToRowType xs
622624 RelationToRowType '[] = '[]
623625
626+-- | `RelationToNullityTypes` drops the column constraints.
624627type family RelationToNullityTypes (rel :: RelationType) :: [NullityType] where
625628 RelationToNullityTypes ('(k, x) : xs) = x : RelationToNullityTypes xs
626629 RelationToNullityTypes '[] = '[]