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.Pi
import Database.Relational.Query.Constraint import Database.Relational.Query.Constraint
(Key, recordConstraint, projectionKey, (Key, recordConstraint, projectionKey,
unique, notNull, HasConstraintKey(constraintKey), uniqueKey, notNullKey, HasConstraintKey(constraintKey),
Primary, Unique, NotNull) Primary, Unique, NotNull)
import Database.Relational.Query.AliasId (Qualified) import Database.Relational.Query.AliasId (Qualified)
import Database.Relational.Query.Expr import Database.Relational.Query.Expr

View File

@ -8,7 +8,7 @@ module Database.Relational.Query.Constraint (
returnKey, appendConstraint, returnKey, appendConstraint,
unique, notNull, uniqueKey, notNullKey,
HasConstraintKey (..), HasConstraintKey (..),
@ -48,11 +48,11 @@ mapConstraint :: (KeyConstraint c0 r -> KeyConstraint c1 r)
-> Key c1 r ct -> Key c1 r ct
mapConstraint f = returnKey . f . recordConstraint mapConstraint f = returnKey . f . recordConstraint
unique :: Key Primary r ct -> Key Unique r ct uniqueKey :: Key Primary r ct -> Key Unique r ct
unique = mapConstraint C.unique uniqueKey = mapConstraint C.unique
notNull :: Key Primary r ct -> Key NotNull r ct notNullKey :: Key Primary r ct -> Key NotNull r ct
notNull = mapConstraint C.notNull notNullKey = mapConstraint C.notNull
class HasConstraintKey c r ct where class HasConstraintKey c r ct where
@ -60,8 +60,8 @@ class HasConstraintKey c r ct where
instance HasConstraintKey Primary r ct instance HasConstraintKey Primary r ct
=> HasConstraintKey Unique r ct where => HasConstraintKey Unique r ct where
constraintKey = unique constraintKey constraintKey = uniqueKey constraintKey
instance HasConstraintKey Primary r ct instance HasConstraintKey Primary r ct
=> HasConstraintKey NotNull r ct where => HasConstraintKey NotNull r ct where
constraintKey = notNull constraintKey constraintKey = notNullKey constraintKey