Rename functions to derive constraint keys.

This commit is contained in:
Kei Hibino 2013-05-11 14:56:05 +09:00
parent 87395e5981
commit 82d0703cfa
2 changed files with 8 additions and 8 deletions

View File

@ -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

View File

@ -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