mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2025-01-05 20:04:49 +03:00
Update document of class methods.
This commit is contained in:
parent
a88e044869
commit
b396dce1b0
@ -86,6 +86,7 @@ notNullKey = mapConstraint C.notNull
|
|||||||
|
|
||||||
-- | Constraint 'Key' inference interface.
|
-- | Constraint 'Key' inference interface.
|
||||||
class HasConstraintKey c r ct where
|
class HasConstraintKey c r ct where
|
||||||
|
-- | Infer constraint key.
|
||||||
constraintKey :: Key c r ct
|
constraintKey :: Key c r ct
|
||||||
|
|
||||||
-- | Inference rule of 'Unique' constraint 'Key'.
|
-- | Inference rule of 'Unique' constraint 'Key'.
|
||||||
|
@ -95,6 +95,7 @@ toExpr = UnsafeExpr.Expr . sqlString where
|
|||||||
|
|
||||||
-- | Projection interface.
|
-- | Projection interface.
|
||||||
class Projectable p where
|
class Projectable p where
|
||||||
|
-- | Project from 'Projection' into weaken projection types.
|
||||||
project :: Projection a -> p a
|
project :: Projection a -> p a
|
||||||
|
|
||||||
-- | Project into 'Projection' type.
|
-- | Project into 'Projection' type.
|
||||||
@ -107,6 +108,7 @@ instance Projectable Expr where
|
|||||||
|
|
||||||
-- | Projection interface for 'Aggregation'.
|
-- | Projection interface for 'Aggregation'.
|
||||||
class AggregateProjectable p where
|
class AggregateProjectable p where
|
||||||
|
-- | Project from 'Aggregation' into weaken projection types.
|
||||||
projectAggregation :: Aggregation a -> p a
|
projectAggregation :: Aggregation a -> p a
|
||||||
|
|
||||||
-- | Project from 'Aggregation' into 'Aggregation'.
|
-- | Project from 'Aggregation' into 'Aggregation'.
|
||||||
@ -126,12 +128,15 @@ expr :: Projection ft -> Expr ft
|
|||||||
expr = toExpr
|
expr = toExpr
|
||||||
|
|
||||||
|
|
||||||
|
-- | Unsafely generate 'Projection' from SQL expression strings.
|
||||||
unsafeSqlTermsProjection :: [String] -> Projection t
|
unsafeSqlTermsProjection :: [String] -> Projection t
|
||||||
unsafeSqlTermsProjection = unsafeFromColumns
|
unsafeSqlTermsProjection = unsafeFromColumns
|
||||||
|
|
||||||
-- | Interface to project SQL terms unsafely.
|
-- | Interface to project SQL terms unsafely.
|
||||||
class SqlProjectable p where
|
class SqlProjectable p where
|
||||||
unsafeProjectSqlTerms :: [String] -> p t
|
-- | Unsafely project from SQL expression strings.
|
||||||
|
unsafeProjectSqlTerms :: [String] -- ^ SQL expression strings
|
||||||
|
-> p t -- ^ Result projection object
|
||||||
|
|
||||||
-- | Unsafely make 'Projection' from SQL terms.
|
-- | Unsafely make 'Projection' from SQL terms.
|
||||||
instance SqlProjectable Projection where
|
instance SqlProjectable Projection where
|
||||||
@ -172,7 +177,9 @@ values = project . unsafeFromColumns . map showConstantSQL
|
|||||||
|
|
||||||
-- | Interface to get SQL term from projections.
|
-- | Interface to get SQL term from projections.
|
||||||
class ProjectableShowSql p where
|
class ProjectableShowSql p where
|
||||||
unsafeShowSql :: p a -> String
|
-- | Unsafely generate SQL expression string from projection object.
|
||||||
|
unsafeShowSql :: p a -- ^ Source projection object
|
||||||
|
-> String -- ^ Result SQL expression string.
|
||||||
|
|
||||||
-- | Unsafely get SQL term from 'Proejction'.
|
-- | Unsafely get SQL term from 'Proejction'.
|
||||||
instance ProjectableShowSql Projection where
|
instance ProjectableShowSql Projection where
|
||||||
@ -368,6 +375,7 @@ placeholder f = do
|
|||||||
|
|
||||||
-- | Interface to zip projections.
|
-- | Interface to zip projections.
|
||||||
class ProjectableZip p where
|
class ProjectableZip p where
|
||||||
|
-- | Zip projections.
|
||||||
projectZip :: p a -> p b -> p (a, b)
|
projectZip :: p a -> p b -> p (a, b)
|
||||||
|
|
||||||
-- | Zip placeholder parameters.
|
-- | Zip placeholder parameters.
|
||||||
@ -388,7 +396,9 @@ instance ProjectableZip Aggregation where
|
|||||||
|
|
||||||
-- | Interface to control 'Maybe' of phantom type in projections.
|
-- | Interface to control 'Maybe' of phantom type in projections.
|
||||||
class ProjectableMaybe p where
|
class ProjectableMaybe p where
|
||||||
|
-- | Cast projection phantom type into 'Maybe'.
|
||||||
just :: p a -> p (Maybe a)
|
just :: p a -> p (Maybe a)
|
||||||
|
-- | Compose nested 'Maybe' phantom type on projection.
|
||||||
flattenMaybe :: p (Maybe (Maybe a)) -> p (Maybe a)
|
flattenMaybe :: p (Maybe (Maybe a)) -> p (Maybe a)
|
||||||
|
|
||||||
-- | Control phantom 'Maybe' type in placeholder parameters.
|
-- | Control phantom 'Maybe' type in placeholder parameters.
|
||||||
|
Loading…
Reference in New Issue
Block a user