Remove SqlReadT
This commit is contained in:
parent
07167f6474
commit
23ac8da92b
@ -781,14 +781,6 @@ veryUnsafeCoerceSqlExprValueList EEmptyList = throw (UnexpectedCaseErr EmptySqlE
|
|||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
type SqlReadT' m a = forall backend.
|
|
||||||
( BackendCompatible SqlBackend backend
|
|
||||||
, IsPersistBackend backend
|
|
||||||
, PersistQueryRead backend
|
|
||||||
, PersistStoreRead backend, PersistUniqueRead backend
|
|
||||||
)
|
|
||||||
=> R.ReaderT backend m a
|
|
||||||
|
|
||||||
-- | (Internal) Execute an @esqueleto@ @SELECT@ 'SqlQuery' inside
|
-- | (Internal) Execute an @esqueleto@ @SELECT@ 'SqlQuery' inside
|
||||||
-- @persistent@'s 'SqlPersistT' monad.
|
-- @persistent@'s 'SqlPersistT' monad.
|
||||||
rawSelectSource :: ( SqlSelect a r
|
rawSelectSource :: ( SqlSelect a r
|
||||||
@ -797,7 +789,7 @@ rawSelectSource :: ( SqlSelect a r
|
|||||||
)
|
)
|
||||||
=> Mode
|
=> Mode
|
||||||
-> SqlQuery a
|
-> SqlQuery a
|
||||||
-> SqlReadT' m1 (Acquire (C.Source m2 r))
|
-> SqlReadT m1 (Acquire (C.Source m2 r))
|
||||||
rawSelectSource mode query =
|
rawSelectSource mode query =
|
||||||
do
|
do
|
||||||
conn <- projectBackend <$> R.ask
|
conn <- projectBackend <$> R.ask
|
||||||
@ -881,7 +873,7 @@ selectSource query = do
|
|||||||
select :: ( SqlSelect a r
|
select :: ( SqlSelect a r
|
||||||
, MonadIO m
|
, MonadIO m
|
||||||
)
|
)
|
||||||
=> SqlQuery a -> SqlReadT' m [r]
|
=> SqlQuery a -> SqlReadT m [r]
|
||||||
select query = do
|
select query = do
|
||||||
res <- rawSelectSource SELECT query
|
res <- rawSelectSource SELECT query
|
||||||
conn <- R.ask
|
conn <- R.ask
|
||||||
@ -921,12 +913,12 @@ runSource src = src C.$$ CL.consume
|
|||||||
|
|
||||||
-- | (Internal) Execute an @esqueleto@ statement inside
|
-- | (Internal) Execute an @esqueleto@ statement inside
|
||||||
-- @persistent@'s 'SqlPersistT' monad.
|
-- @persistent@'s 'SqlPersistT' monad.
|
||||||
rawEsqueleto :: ( MonadIO m, SqlSelect a r, IsSqlBackend backend)
|
rawEsqueleto :: ( MonadIO m, SqlSelect a r, BackendCompatible SqlBackend backend)
|
||||||
=> Mode
|
=> Mode
|
||||||
-> SqlQuery a
|
-> SqlQuery a
|
||||||
-> R.ReaderT backend m Int64
|
-> R.ReaderT backend m Int64
|
||||||
rawEsqueleto mode query = do
|
rawEsqueleto mode query = do
|
||||||
conn <- persistBackend <$> R.ask
|
conn <- R.ask
|
||||||
uncurry rawExecuteCount $
|
uncurry rawExecuteCount $
|
||||||
first builderToText $
|
first builderToText $
|
||||||
toRawSql mode (conn, initialIdentState) query
|
toRawSql mode (conn, initialIdentState) query
|
||||||
@ -1008,7 +1000,7 @@ builderToText = TL.toStrict . TLB.toLazyTextWith defaultChunkSize
|
|||||||
-- possible but tedious), you may just turn on query logging of
|
-- possible but tedious), you may just turn on query logging of
|
||||||
-- @persistent@.
|
-- @persistent@.
|
||||||
toRawSql
|
toRawSql
|
||||||
:: (IsSqlBackend backend, SqlSelect a r)
|
:: (SqlSelect a r, BackendCompatible SqlBackend backend)
|
||||||
=> Mode -> (backend, IdentState) -> SqlQuery a -> (TLB.Builder, [PersistValue])
|
=> Mode -> (backend, IdentState) -> SqlQuery a -> (TLB.Builder, [PersistValue])
|
||||||
toRawSql mode (conn, firstIdentState) query =
|
toRawSql mode (conn, firstIdentState) query =
|
||||||
let ((ret, sd), finalIdentState) =
|
let ((ret, sd), finalIdentState) =
|
||||||
@ -1028,7 +1020,7 @@ toRawSql mode (conn, firstIdentState) query =
|
|||||||
-- that were used) to the subsequent calls. This ensures
|
-- that were used) to the subsequent calls. This ensures
|
||||||
-- that no name clashes will occur on subqueries that may
|
-- that no name clashes will occur on subqueries that may
|
||||||
-- appear on the expressions below.
|
-- appear on the expressions below.
|
||||||
info = (persistBackend conn, finalIdentState)
|
info = (projectBackend conn, finalIdentState)
|
||||||
in mconcat
|
in mconcat
|
||||||
[ makeInsertInto info mode ret
|
[ makeInsertInto info mode ret
|
||||||
, makeSelect info mode distinctClause ret
|
, makeSelect info mode distinctClause ret
|
||||||
|
|||||||
@ -4,10 +4,17 @@ resolver: lts-8.8
|
|||||||
|
|
||||||
packages:
|
packages:
|
||||||
- '.'
|
- '.'
|
||||||
|
- location:
|
||||||
|
git: https://github.com/parsonsmatt/persistent
|
||||||
|
commit: a4f21ad5db9b65a5febf79a1be091597210a73ca
|
||||||
|
subdirs:
|
||||||
|
- persistent
|
||||||
|
extra-dep: true
|
||||||
|
|
||||||
extra-deps:
|
extra-deps:
|
||||||
- doctest-prop-0.2.0.1
|
- doctest-prop-0.2.0.1
|
||||||
- quickcheck-properties-0.1
|
- quickcheck-properties-0.1
|
||||||
- persistent-2.7.1
|
# - persistent-2.7.1
|
||||||
# - http-client-0.5.0
|
# - http-client-0.5.0
|
||||||
# - fail-4.9.0.0
|
# - fail-4.9.0.0
|
||||||
# - http-types-0.9
|
# - http-types-0.9
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user