persistable-record 0.6.0.1 → 0.6.0.2
raw patch · 3 files changed
+19/−5 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- persistable-record.cabal +1/−1
- src/Database/Record/TH.hs +14/−4
ChangeLog.md view
@@ -1,5 +1,9 @@ <!-- -*- Markdown -*- --> +## 0.6.0.2++- bugfix: pass correct table name to macro for field label defintion.+ ## 0.6.0.1 - fix changelog.
persistable-record.cabal view
@@ -1,5 +1,5 @@ name: persistable-record-version: 0.6.0.1+version: 0.6.0.2 synopsis: Binding between SQL database values and haskell records. description: This package contiains types to represent table constraints and interfaces to bind between SQL database values and Haskell records.
src/Database/Record/TH.hs view
@@ -80,9 +80,11 @@ data NameConfig = NameConfig { recordTypeName :: String -> String -> ConName- -- ^ Make record type symbol name from schema name and table name in SQL+ -- ^ Make record type name generated from the table's definition.+ -- The first argument is the schema name of the table, and the second argument is the table name. , columnName :: String -> String -> VarName- -- ^ Make column variable symbol name from table name and column name in SQL+ -- ^ Make each field label of the record type generated from the table's definition.+ -- The first argument is the table name, and the second argument is the column name. } -- | Dummy show instance. Handy to define show instance recursively.@@ -90,7 +92,15 @@ show = const "<nameConfig>" -- | Default implementation of 'NameConfig' type.--- To customize this, use record update syntax.+-- To change how the generated record type and its columns are named,+-- use record update syntax:+--+-- > defaultNameConfig+-- > { recordTypeName = \schema table -> varNameWithPrefix table schema+-- > ^ append the table name after the schema name. e.g. "schemaTable"+-- > , columnName = \table column -> varNameWithPrefix column table+-- > ^ append the column name after the table name. e.g. "tableColumn"+-- > } defaultNameConfig :: NameConfig defaultNameConfig = NameConfig@@ -188,7 +198,7 @@ defineRecordTypeWithConfig config schema table columns = defineRecordType (recordTypeName config schema table)- [ (columnName config schema n, t) | (n, t) <- columns ]+ [ (columnName config table n, t) | (n, t) <- columns ] -- | Templates for single column value type. deriveNotNullType :: TypeQ -> Q [Dec]