Add SqlSelect instance for :& (#268)
* Add SqlSelect instance for (:&) Motivation is given in bitemyapp/esqueleto#267 - this instance allows for polymorphic use of the new Experimental API, where it otherwise wouldn't be possible to split `a :& b` into `(a, b)`. * Bump version to 3.5.2.0
This commit is contained in:
parent
33128042c4
commit
3a12a15d00
@ -1,3 +1,10 @@
|
||||
3.5.2.0
|
||||
=======
|
||||
- @ivanbakel
|
||||
- [#268](https://github.com/bitemyapp/esqueleto/pull/268)
|
||||
- Added `SqlSelect` instance for `(:&)`, allowing it to be returned from
|
||||
queries just like `(,)` tuples.
|
||||
|
||||
3.5.1.0
|
||||
=======
|
||||
- @ibarrae
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
cabal-version: 1.12
|
||||
|
||||
name: esqueleto
|
||||
version: 3.5.1.0
|
||||
version: 3.5.2.0
|
||||
synopsis: Type-safe EDSL for SQL queries on persistent backends.
|
||||
description: @esqueleto@ is a bare bones, type-safe EDSL for SQL queries that works with unmodified @persistent@ SQL backends. Its language closely resembles SQL, so you don't have to learn new concepts, just new syntax, and it's fairly easy to predict the generated SQL and optimize it for your backend. Most kinds of errors committed when writing SQL are caught as compile-time errors---although it is possible to write type-checked @esqueleto@ queries that fail at runtime.
|
||||
.
|
||||
|
||||
@ -49,6 +49,18 @@ class ValidOnClause a
|
||||
instance {-# OVERLAPPABLE #-} ToFrom a a' => ValidOnClause a
|
||||
instance ValidOnClause (a -> SqlQuery b)
|
||||
|
||||
-- | You may return joined values from a 'select' query - this is
|
||||
-- identical to the tuple instance, but is provided for convenience.
|
||||
--
|
||||
-- @since 3.5.2.0
|
||||
instance (SqlSelect a ra, SqlSelect b rb) => SqlSelect (a :& b) (ra :& rb) where
|
||||
sqlSelectCols esc (a :& b) = sqlSelectCols esc (a, b)
|
||||
sqlSelectColCount = sqlSelectColCount . toTuple
|
||||
where
|
||||
toTuple :: Proxy (a :& b) -> Proxy (a, b)
|
||||
toTuple = const Proxy
|
||||
sqlSelectProcessRow = fmap (uncurry (:&)) . sqlSelectProcessRow
|
||||
|
||||
-- | An @ON@ clause that describes how two tables are related. This should be
|
||||
-- used as an infix operator after a 'JOIN'. For example,
|
||||
--
|
||||
|
||||
Loading…
Reference in New Issue
Block a user