relational-query 0.5.1.0 → 0.5.1.1
raw patch · 12 files changed
+40/−25 lines, 12 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- relational-query.cabal +1/−1
- src/Database/Relational/Query/Derives.hs +3/−3
- src/Database/Relational/Query/Monad/Class.hs +1/−1
- src/Database/Relational/Query/Monad/Trans/Join.hs +1/−1
- src/Database/Relational/Query/Pi/Unsafe.hs +2/−2
- src/Database/Relational/Query/Projectable.hs +1/−1
- src/Database/Relational/Query/Projection.hs +2/−2
- src/Database/Relational/Query/Relation.hs +21/−10
- src/Database/Relational/Query/Sub.hs +1/−1
- src/Database/Relational/Query/TH.hs +1/−1
- src/Database/Relational/Query/Type.hs +2/−2
ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.5.1.1++- Update documentation.+ ## 0.5.1.0 - Add the arrow combinator module and its unit-test cases.
relational-query.cabal view
@@ -1,5 +1,5 @@ name: relational-query-version: 0.5.1.0+version: 0.5.1.1 synopsis: Typeful, Modular, Relational, algebraic query engine description: This package contiains typeful relation structure and relational-algebraic query building DSL which can
src/Database/Relational/Query/Derives.hs view
@@ -70,7 +70,7 @@ -> Relation p a -- ^ Result restricted 'Relation' primary' = specifiedKey . projectionKey --- | Query restricted with infered primary key.+-- | Query restricted with inferred primary key. primary :: HasConstraintKey Primary a p => Relation () a -- ^ 'Relation' to add restriction. -> Relation p a -- ^ Result restricted 'Relation'@@ -94,13 +94,13 @@ -> KeyUpdate p r -- ^ Result typed 'Update' updateByConstraintKey table' = typedKeyUpdate table' . Constraint.projectionKey --- | Typed 'KeyUpdate' using infered primary key.+-- | Typed 'KeyUpdate' using inferred primary key. primaryUpdate :: (HasConstraintKey Primary r p) => Table r -- ^ 'Table' to update -> KeyUpdate p r -- ^ Result typed 'Update' primaryUpdate table' = updateByConstraintKey table' (uniqueKey constraintKey) --- | 'UniqueRelation' infered from table.+-- | 'UniqueRelation' inferred from table. derivedUniqueRelation :: TableDerivable r => Key Unique r k -- ^ Unique key proof object which record type is 'a' and key type is 'p'. -> Projection c k -- ^ Unique key value to specify.
src/Database/Relational/Query/Monad/Class.hs view
@@ -45,7 +45,7 @@ -- | Add restriction to last join. restrictJoin :: Projection Flat (Maybe Bool) -- ^ 'Projection' which represent restriction -> m () -- ^ Restricted query context- -- | Unsafely join subquery with this query.+ -- | Unsafely join sub-query with this query. unsafeSubQuery :: NodeAttr -- ^ Attribute maybe or just -> Qualified SubQuery -- ^ 'SubQuery' to join -> m (Projection Flat r) -- ^ Result joined context and 'SubQuery' result projection.
src/Database/Relational/Query/Monad/Trans/Join.hs view
@@ -66,7 +66,7 @@ restrictJoin = updateJoinRestriction . expr unsafeSubQuery = unsafeSubQueryWithAttr --- | Unsafely join subquery with this query.+-- | Unsafely join sub-query with this query. unsafeSubQueryWithAttr :: Monad q => NodeAttr -- ^ Attribute maybe or just -> Qualified SubQuery -- ^ 'SubQuery' to join
src/Database/Relational/Query/Pi/Unsafe.hs view
@@ -124,7 +124,7 @@ definePi' pw i = Pi (Leftest i) pw -- | Unsafely define projection path from type 'r0' into type 'r1'.--- Use infered 'PersistableRecordWidth'.+-- Use inferred 'PersistableRecordWidth'. definePi :: PersistableWidth r1 => Int -- ^ Index of flat SQL value list -> Pi r0 r1 -- ^ Result projection path@@ -137,7 +137,7 @@ defineDirectPi' pw is = Pi (Map is) pw -- | Unsafely define projection path from type 'r0' into type 'r1'.--- Use infered 'PersistableRecordWidth'.+-- Use inferred 'PersistableRecordWidth'. defineDirectPi :: PersistableWidth r1 => [Int] -- ^ Indexes of flat SQL value list -> Pi r0 r1 -- ^ Result projection path
src/Database/Relational/Query/Projectable.hs view
@@ -566,7 +566,7 @@ -- | Method like 'fmap'. (|$|) :: ProductConstructor (a -> b) => (a -> b) -> p a -> p b --- | Same as '|$|' other than using infered record constructor.+-- | Same as '|$|' other than using inferred record constructor. ipfmap :: (ProjectableFunctor p, ProductConstructor (a -> b)) => p a -> p b ipfmap = (|$|) productConstructor
src/Database/Relational/Query/Projection.hs view
@@ -90,11 +90,11 @@ -> Projection c r -- ^ Result 'Projection' unsafeFromColumns = typedProjection . untypedProjectionFromColumns --- | Unsafely generate 'Projection' from qualified (joined) subquery.+-- | Unsafely generate 'Projection' from qualified (joined) sub-query. unsafeFromQualifiedSubQuery :: Qualified SubQuery -> Projection c t unsafeFromQualifiedSubQuery = typedProjection . untypedProjectionFromJoinedSubQuery --- | Unsafely generate 'Projection' from scalar subquery.+-- | Unsafely generate 'Projection' from scalar sub-query. unsafeFromScalarSubQuery :: SubQuery -> Projection c t unsafeFromScalarSubQuery = typedProjection . untypedProjectionFromScalarSubQuery
src/Database/Relational/Query/Relation.hs view
@@ -118,19 +118,19 @@ unsafeSubQuery attr q -- d (Relation q) = unsafeMergeAnotherQuery attr q --- | Join subquery with place-holder parameter 'p'. query result is not 'Maybe'.+-- | Join sub-query with place-holder parameter 'p'. query result is not 'Maybe'. query' :: (MonadQualify ConfigureQuery m, MonadQuery m) => Relation p r -> m (PlaceHolders p, Projection Flat r) query' = queryWithAttr Just' --- | Join subquery. Query result is not 'Maybe'.+-- | Join sub-query. Query result is not 'Maybe'. query :: (MonadQualify ConfigureQuery m, MonadQuery m) => Relation () r -> m (Projection Flat r) query = fmap snd . query' --- | Join subquery with place-holder parameter 'p'. Query result is 'Maybe'.+-- | Join sub-query with place-holder parameter 'p'. Query result is 'Maybe'. queryMaybe' :: (MonadQualify ConfigureQuery m, MonadQuery m) => Relation p r -> m (PlaceHolders p, Projection Flat (Maybe r))@@ -138,7 +138,18 @@ (ph, pj) <- queryWithAttr Maybe pr return (ph, Projection.just pj) --- | Join subquery. Query result is 'Maybe'.+-- | Join sub-query. Query result is 'Maybe'.+-- The combinations of 'query' and 'queryMaybe' express+-- inner joins, left outer joins, right outer joins, and full outer joins.+-- Here is an example of a right outer join:+--+-- @+-- outerJoin = relation $ do+-- e <- queryMaybe employee+-- d <- query department+-- on $ e ?! E.deptId' .=. just (d ! D.deptId')+-- return $ (,) |$| e |*| d+-- @ queryMaybe :: (MonadQualify ConfigureQuery m, MonadQuery m) => Relation () r -> m (Projection Flat (Maybe r))@@ -149,7 +160,7 @@ . fmap Projection.unsafeListFromSubQuery . subQueryQualifyFromRelation --- | List subQuery, for /IN/ and /EXIST/ with place-holder parameter 'p'.+-- | List sub-query, for /IN/ and /EXIST/ with place-holder parameter 'p'. queryList' :: MonadQualify ConfigureQuery m => Relation p r -> m (PlaceHolders p, ListProjection (Projection c) r)@@ -157,7 +168,7 @@ ql <- queryList0 rel return (placeHoldersFromRelation rel, ql) --- | List subQuery, for /IN/ and /EXIST/.+-- | List sub-query, for /IN/ and /EXIST/. queryList :: MonadQualify ConfigureQuery m => Relation () r -> m (ListProjection (Projection c) r)@@ -410,13 +421,13 @@ qualifyQuery sq Projection.unsafeChangeContext <$> unsafeSubQuery attr q --- | Join unique subquery with place-holder parameter 'p'.+-- | Join unique sub-query with place-holder parameter 'p'. uniqueQuery' :: MonadQualifyUnique ConfigureQuery m => UniqueRelation p c r -> m (PlaceHolders p, Projection c r) uniqueQuery' = uniqueQueryWithAttr Just' --- | Join unique subquery with place-holder parameter 'p'. Query result is 'Maybe'.+-- | Join unique sub-query with place-holder parameter 'p'. Query result is 'Maybe'. uniqueQueryMaybe' :: MonadQualifyUnique ConfigureQuery m => UniqueRelation p c r -> m (PlaceHolders p, Projection c (Maybe r))@@ -437,7 +448,7 @@ (ph, a) <- query' rel return (ph, ag $ a ! k) --- | Scalar subQuery with place-holder parameter 'p'.+-- | Scalar sub-query with place-holder parameter 'p'. queryScalar' :: (MonadQualify ConfigureQuery m, ScalarDegree r) => UniqueRelation p c r -> m (PlaceHolders p, Projection c (Maybe r))@@ -445,7 +456,7 @@ unsafeAddPlaceHolders . liftQualify $ Projection.unsafeFromScalarSubQuery <$> subQueryQualifyFromRelation (unUnique ur) --- | Scalar subQuery.+-- | Scalar sub-query. queryScalar :: (MonadQualify ConfigureQuery m, ScalarDegree r) => UniqueRelation () c r -> m (Projection c (Maybe r))
src/Database/Relational/Query/Sub.hs view
@@ -170,7 +170,7 @@ -- | SQL string for nested-query and toplevel-SQL. toSQLs :: SubQuery- -> (StringSQL, StringSQL) -- ^ subquery SQL and top-level SQL+ -> (StringSQL, StringSQL) -- ^ sub-query SQL and top-level SQL toSQLs = d where d (Table u) = (stringSQL $ Table.name' u, fromTableToSQL u) d (Bin (BinOp (op, da)) l r) = (SQL.paren q, q) where
src/Database/Relational/Query/TH.hs view
@@ -194,7 +194,7 @@ derivedTable = Table.table $(stringE table) $(listE $ map stringE columns) |] --- | Template to define infered entries from table type.+-- | Template to define inferred entries from table type. defineTableDerivations :: VarName -- ^ Table declaration variable name -> VarName -- ^ Relation declaration variable name -> VarName -- ^ Insert statement declaration variable name
src/Database/Relational/Query/Type.hs view
@@ -191,7 +191,7 @@ typedInsert :: Table r -> Pi r r' -> Insert r' typedInsert = typedInsert' defaultConfig --- | Table type infered 'Insert'.+-- | Table type inferred 'Insert'. derivedInsert :: TableDerivable r => Pi r r' -> Insert r' derivedInsert = typedInsert derivedTable @@ -218,7 +218,7 @@ typedInsertQuery :: Table r -> Pi r r' -> Relation p r' -> InsertQuery p typedInsertQuery = typedInsertQuery' defaultConfig --- | Table type infered 'InsertQuery'.+-- | Table type inferred 'InsertQuery'. derivedInsertQuery :: TableDerivable r => Pi r r' -> Relation p r' -> InsertQuery p derivedInsertQuery = typedInsertQuery derivedTable