mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-11-29 14:45:51 +03:00
Reduce dependency to Persistable.
This commit is contained in:
parent
8657453111
commit
3c2fd276aa
@ -25,15 +25,14 @@ module Database.Record.FromSql (
|
||||
maybeRecord,
|
||||
|
||||
-- * Inference rules of 'RecordFromSql' conversion
|
||||
FromSql (recordFromSql), recordFromSql',
|
||||
FromSql (recordFromSql),
|
||||
takeRecord, toRecord,
|
||||
|
||||
valueFromSql
|
||||
) where
|
||||
|
||||
import Database.Record.Persistable
|
||||
(PersistableRecord,
|
||||
Persistable(persistable), PersistableType,
|
||||
(PersistableType, PersistableRecord,
|
||||
PersistableValue, persistableValue, toValue)
|
||||
import qualified Database.Record.Persistable as Persistable
|
||||
import Database.Record.KeyConstraint
|
||||
@ -90,10 +89,6 @@ createRecordFromSql = RecordFromSql
|
||||
recordDeSerializer :: PersistableRecord q a -> RecordFromSql q a
|
||||
recordDeSerializer = createRecordFromSql . Persistable.takeRecord
|
||||
|
||||
-- | Inferred 'RecordFromSql' proof object.
|
||||
recordFromSql' :: Persistable q a => RecordFromSql q a
|
||||
recordFromSql' = recordDeSerializer persistable
|
||||
|
||||
-- | Run 'RecordFromSql' proof object. Convert from list of SQL type ['q'] into Haskell type 'a'.
|
||||
runToRecord :: RecordFromSql q a -- ^ Proof object which has capability to convert
|
||||
-> [q] -- ^ list of SQL type
|
||||
|
@ -23,7 +23,7 @@ module Database.Record.ToSql (
|
||||
(<&>),
|
||||
|
||||
-- * Inference rules of 'RecordToSql' conversion
|
||||
ToSql (recordToSql), recordToSql',
|
||||
ToSql (recordToSql),
|
||||
putRecord, putEmpty, fromRecord, wrapToSql,
|
||||
|
||||
valueToSql,
|
||||
@ -47,7 +47,7 @@ import qualified Data.DList as DList
|
||||
import Database.Record.Persistable
|
||||
(PersistableSqlType, runPersistableNullValue, PersistableType (persistableType),
|
||||
PersistableRecordWidth, runPersistableRecordWidth, PersistableWidth(persistableWidth),
|
||||
PersistableRecord, Persistable(persistable), PersistableValue, persistableValue, fromValue)
|
||||
PersistableRecord, PersistableValue, persistableValue, fromValue)
|
||||
import Database.Record.KeyConstraint
|
||||
(Primary, Unique, KeyConstraint, HasKeyConstraint(keyConstraint), unique, indexes)
|
||||
import qualified Database.Record.Persistable as Persistable
|
||||
@ -84,10 +84,6 @@ createRecordToSql f = wrapToSql $ tell . DList.fromList . f
|
||||
recordSerializer :: PersistableRecord q a -> RecordToSql q a
|
||||
recordSerializer = createRecordToSql . Persistable.fromRecord
|
||||
|
||||
-- | Inferred 'RecordToSql' proof object.
|
||||
recordToSql' :: Persistable q a => RecordToSql q a
|
||||
recordToSql' = recordSerializer persistable
|
||||
|
||||
-- | Derivation rule of 'RecordToSql' proof object for Haskell tuple (,) type.
|
||||
(<&>) :: RecordToSql q a -> RecordToSql q b -> RecordToSql q (a, b)
|
||||
ra <&> rb = RecordToSql $ \(a, b) -> do
|
||||
|
Loading…
Reference in New Issue
Block a user