mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-12-12 12:09:08 +03:00
Rename functions to derive constraint keys.
This commit is contained in:
parent
87395e5981
commit
82d0703cfa
@ -16,7 +16,7 @@ import Database.Relational.Query.Table (Table)
|
||||
import Database.Relational.Query.Pi
|
||||
import Database.Relational.Query.Constraint
|
||||
(Key, recordConstraint, projectionKey,
|
||||
unique, notNull, HasConstraintKey(constraintKey),
|
||||
uniqueKey, notNullKey, HasConstraintKey(constraintKey),
|
||||
Primary, Unique, NotNull)
|
||||
import Database.Relational.Query.AliasId (Qualified)
|
||||
import Database.Relational.Query.Expr
|
||||
|
@ -8,7 +8,7 @@ module Database.Relational.Query.Constraint (
|
||||
|
||||
returnKey, appendConstraint,
|
||||
|
||||
unique, notNull,
|
||||
uniqueKey, notNullKey,
|
||||
|
||||
HasConstraintKey (..),
|
||||
|
||||
@ -48,11 +48,11 @@ mapConstraint :: (KeyConstraint c0 r -> KeyConstraint c1 r)
|
||||
-> Key c1 r ct
|
||||
mapConstraint f = returnKey . f . recordConstraint
|
||||
|
||||
unique :: Key Primary r ct -> Key Unique r ct
|
||||
unique = mapConstraint C.unique
|
||||
uniqueKey :: Key Primary r ct -> Key Unique r ct
|
||||
uniqueKey = mapConstraint C.unique
|
||||
|
||||
notNull :: Key Primary r ct -> Key NotNull r ct
|
||||
notNull = mapConstraint C.notNull
|
||||
notNullKey :: Key Primary r ct -> Key NotNull r ct
|
||||
notNullKey = mapConstraint C.notNull
|
||||
|
||||
|
||||
class HasConstraintKey c r ct where
|
||||
@ -60,8 +60,8 @@ class HasConstraintKey c r ct where
|
||||
|
||||
instance HasConstraintKey Primary r ct
|
||||
=> HasConstraintKey Unique r ct where
|
||||
constraintKey = unique constraintKey
|
||||
constraintKey = uniqueKey constraintKey
|
||||
|
||||
instance HasConstraintKey Primary r ct
|
||||
=> HasConstraintKey NotNull r ct where
|
||||
constraintKey = notNull constraintKey
|
||||
constraintKey = notNullKey constraintKey
|
||||
|
Loading…
Reference in New Issue
Block a user