generated from tpl/purs
Compare commits
14 Commits
341971d3f3
...
901e931af4
Author | SHA1 | Date | |
---|---|---|---|
901e931af4 | |||
d5cc8ad95e | |||
1a96e2e6d8 | |||
8350bc1c4a | |||
fad3e8dbcb | |||
275bbe3583 | |||
1d3c16a3a5 | |||
a45aaf5647 | |||
223eeb9160 | |||
7044099d54 | |||
814b1ad590 | |||
bce45daa27 | |||
8a6f84e8bf | |||
cd01d280f4 |
90
README.md
90
README.md
@ -259,59 +259,59 @@ the api of [`node-postgres`]:
|
|||||||
- release clients with [`Pool.release`] or [`Pool.destroy`]
|
- release clients with [`Pool.release`] or [`Pool.destroy`]
|
||||||
- release with [`Pool.end`]
|
- release with [`Pool.end`]
|
||||||
|
|
||||||
[`Pool`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Effect.Aff.Postgres.Pool#t:Pool
|
[`Pool`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Effect.Aff.Postgres.Pool#t:Pool
|
||||||
[`Config`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Effect.Aff.Postgres.Pool#t:Config
|
[`Config`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Effect.Aff.Postgres.Pool#t:Config
|
||||||
[`Pool.make`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Effect.Aff.Postgres.Pool#v:make
|
[`Pool.make`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Effect.Aff.Postgres.Pool#v:make
|
||||||
[`Pool.end`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Effect.Aff.Postgres.Pool#v:end
|
[`Pool.end`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Effect.Aff.Postgres.Pool#v:end
|
||||||
[`Pool.connect`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Effect.Aff.Postgres.Pool#v:connect
|
[`Pool.connect`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Effect.Aff.Postgres.Pool#v:connect
|
||||||
[`Pool.destroy`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Effect.Aff.Postgres.Pool#v:destroy
|
[`Pool.destroy`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Effect.Aff.Postgres.Pool#v:destroy
|
||||||
[`Pool.release`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Effect.Aff.Postgres.Pool#v:release
|
[`Pool.release`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Effect.Aff.Postgres.Pool#v:release
|
||||||
|
|
||||||
[`Client`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Effect.Aff.Postgres.Client#t:Client
|
[`Client`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Effect.Aff.Postgres.Client#t:Client
|
||||||
[`Client.end`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Effect.Aff.Postgres.Client#v:end
|
[`Client.end`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Effect.Aff.Postgres.Client#v:end
|
||||||
[`Client.make`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Effect.Aff.Postgres.Client#v:make
|
[`Client.make`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Effect.Aff.Postgres.Client#v:make
|
||||||
[`Client.connected`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Effect.Aff.Postgres.Client#v:connected
|
[`Client.connected`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Effect.Aff.Postgres.Client#v:connected
|
||||||
[`Client.query`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Effect.Aff.Postgres.Client#v:query
|
[`Client.query`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Effect.Aff.Postgres.Client#v:query
|
||||||
[`Client.queryRaw`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Effect.Aff.Postgres.Client#v:queryRaw
|
[`Client.queryRaw`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Effect.Aff.Postgres.Client#v:queryRaw
|
||||||
[`Client.exec`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Effect.Aff.Postgres.Client#v:exec
|
[`Client.exec`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Effect.Aff.Postgres.Client#v:exec
|
||||||
|
|
||||||
[`Range`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Data.Postgres.Range#t:Range
|
[`Range`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Data.Postgres.Range#t:Range
|
||||||
[`Range.gt`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Data.Postgres.Range#v:gt
|
[`Range.gt`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Data.Postgres.Range#v:gt
|
||||||
[`Range.gte`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Data.Postgres.Range#v:gte
|
[`Range.gte`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Data.Postgres.Range#v:gte
|
||||||
[`Range.lt`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Data.Postgres.Range#v:lt
|
[`Range.lt`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Data.Postgres.Range#v:lt
|
||||||
[`Range.lte`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Data.Postgres.Range#v:lte
|
[`Range.lte`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Data.Postgres.Range#v:lte
|
||||||
|
|
||||||
[`Raw`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Data.Postgres.Raw#t:Raw
|
[`Raw`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Data.Postgres.Raw#t:Raw
|
||||||
[`Null`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Data.Postgres.Raw#t:Null
|
[`Null`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Data.Postgres.Raw#t:Null
|
||||||
|
|
||||||
[`Serialize`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Data.Postgres#t:Serialize
|
[`Serialize`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Data.Postgres#t:Serialize
|
||||||
[`Deserialize`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Data.Postgres#t:Deserialize
|
[`Deserialize`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Data.Postgres#t:Deserialize
|
||||||
[`Rep`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Data.Postgres#t:Rep
|
[`Rep`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Data.Postgres#t:Rep
|
||||||
[`modifyPgTypes`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Data.Postgres#v:modifyPgTypes
|
[`modifyPgTypes`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Data.Postgres#v:modifyPgTypes
|
||||||
|
|
||||||
[`Result`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Data.Postgres.Result#t:Result
|
[`Result`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Data.Postgres.Result#t:Result
|
||||||
[`FromRow`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Data.Postgres.Result#t:FromRow
|
[`FromRow`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Data.Postgres.Result#t:FromRow
|
||||||
[`FromRows`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Data.Postgres.Result#t:FromRows
|
[`FromRows`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Data.Postgres.Result#t:FromRows
|
||||||
|
|
||||||
[`Query`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Data.Postgres.Query#t:Query
|
[`Query`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Data.Postgres.Query#t:Query
|
||||||
[`AsQuery`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Data.Postgres.Query#t:AsQuery
|
[`AsQuery`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Data.Postgres.Query#t:AsQuery
|
||||||
|
|
||||||
[`Query.Builder`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Data.Postgres.Query.Builder#t:Builder
|
[`Query.Builder`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Data.Postgres.Query.Builder#t:Builder
|
||||||
[`Query.Builder.param`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Data.Postgres.Query.Builder#v:param
|
[`Query.Builder.param`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Data.Postgres.Query.Builder#v:param
|
||||||
[`Query.Builder.build`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Data.Postgres.Query.Builder#v:build
|
[`Query.Builder.build`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Data.Postgres.Query.Builder#v:build
|
||||||
|
|
||||||
[`MonadCursor`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Control.Monad.Postgres#t:MonadCursor
|
[`MonadCursor`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Control.Monad.Postgres#t:MonadCursor
|
||||||
[`MonadSession`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Control.Monad.Postgres#t:MonadSession
|
[`MonadSession`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Control.Monad.Postgres#t:MonadSession
|
||||||
[`CursorT`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Control.Monad.Postgres#t:CursorT
|
[`CursorT`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Control.Monad.Postgres#t:CursorT
|
||||||
[`SessionT`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Control.Monad.Postgres#t:SessionT
|
[`SessionT`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Control.Monad.Postgres#t:SessionT
|
||||||
[`PostgresT`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Control.Monad.Postgres#t:PostgresT
|
[`PostgresT`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Control.Monad.Postgres#t:PostgresT
|
||||||
[`cursor`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Control.Monad.Postgres#v:cursor
|
[`cursor`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Control.Monad.Postgres#v:cursor
|
||||||
[`session`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Control.Monad.Postgres#v:session
|
[`session`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Control.Monad.Postgres#v:session
|
||||||
[`transaction`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Control.Monad.Postgres#v:transaction
|
[`transaction`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Control.Monad.Postgres#v:transaction
|
||||||
[`runPostgres`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Control.Monad.Postgres#v:runPostgres
|
[`runPostgres`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Control.Monad.Postgres#v:runPostgres
|
||||||
[`query`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Control.Monad.Postgres#v:query
|
[`query`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Control.Monad.Postgres#v:query
|
||||||
[`exec`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Control.Monad.Postgres#v:exec
|
[`exec`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Control.Monad.Postgres#v:exec
|
||||||
[`exec_`]: https://pursuit.purescript.org////////////////////////////////////////////packages/purescript-postgresql/2.0.1/Control.Monad.Postgres#v:exec_
|
[`exec_`]: https://pursuit.purescript.org//////////////////////////////////////////////////////packages/purescript-postgresql/2.0.11/Control.Monad.Postgres#v:exec_
|
||||||
|
|
||||||
[`node-postgres`]: https://node-postgres.com/
|
[`node-postgres`]: https://node-postgres.com/
|
||||||
[`pg-types`]: https://github.com/brianc/node-pg-types/
|
[`pg-types`]: https://github.com/brianc/node-pg-types/
|
||||||
|
@ -25,6 +25,7 @@ workspace:
|
|||||||
- newtype: ">=5.0.0 <6.0.0"
|
- newtype: ">=5.0.0 <6.0.0"
|
||||||
- node-buffer: ">=9.0.0 <10.0.0"
|
- node-buffer: ">=9.0.0 <10.0.0"
|
||||||
- node-event-emitter: ">=3.0.0 <4.0.0"
|
- node-event-emitter: ">=3.0.0 <4.0.0"
|
||||||
|
- node-fs: ">=9.1.0 <9.2.0"
|
||||||
- node-stream-pipes: ">=2.1.0 <3.0.0"
|
- node-stream-pipes: ">=2.1.0 <3.0.0"
|
||||||
- node-streams: ">=9.0.0 <10.0.0"
|
- node-streams: ">=9.0.0 <10.0.0"
|
||||||
- nullable: ">=6.0.0 <7.0.0"
|
- nullable: ">=6.0.0 <7.0.0"
|
||||||
@ -731,8 +732,8 @@ packages:
|
|||||||
- unsafe-coerce
|
- unsafe-coerce
|
||||||
node-stream-pipes:
|
node-stream-pipes:
|
||||||
type: registry
|
type: registry
|
||||||
version: 2.1.1
|
version: 2.1.4
|
||||||
integrity: sha256-j7ZE+Vtc9gwXlH8s8pyVsbbCMd91AIRk05IOsZAO7x0=
|
integrity: sha256-/DyKe03WTu5e4EJ5Ym7lvRhakhztLtNhy8fccE8+Ouw=
|
||||||
dependencies:
|
dependencies:
|
||||||
- aff
|
- aff
|
||||||
- arrays
|
- arrays
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package:
|
package:
|
||||||
name: postgresql
|
name: postgresql
|
||||||
publish:
|
publish:
|
||||||
version: '2.0.1'
|
version: '2.0.11'
|
||||||
license: 'GPL-3.0-or-later'
|
license: 'GPL-3.0-or-later'
|
||||||
location:
|
location:
|
||||||
githubOwner: 'cakekindel'
|
githubOwner: 'cakekindel'
|
||||||
@ -54,6 +54,7 @@ package:
|
|||||||
- typelevel-prelude: ">=7.0.0 <8.0.0"
|
- typelevel-prelude: ">=7.0.0 <8.0.0"
|
||||||
- unlift: ">=1.0.1 <2.0.0"
|
- unlift: ">=1.0.1 <2.0.0"
|
||||||
- unsafe-coerce: ">=6.0.0 <7.0.0"
|
- unsafe-coerce: ">=6.0.0 <7.0.0"
|
||||||
|
- node-fs: ">=9.1.0 <9.2.0"
|
||||||
test:
|
test:
|
||||||
main: Test.Main
|
main: Test.Main
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -71,8 +71,7 @@ class (Monad m, MonadSession session, MonadCursor cursor ct) <= MonadPostgres m
|
|||||||
cursorWith :: forall q. AsQuery q => (Array Raw -> RepT ct) -> String -> q -> cursor ~> m
|
cursorWith :: forall q. AsQuery q => (Array Raw -> RepT ct) -> String -> q -> cursor ~> m
|
||||||
|
|
||||||
instance
|
instance
|
||||||
( MonadBracket Effect.Error f m
|
( MonadAff m
|
||||||
, MonadAff m
|
|
||||||
, MonadSession (SessionT m)
|
, MonadSession (SessionT m)
|
||||||
, MonadCursor (CursorT t (SessionT m)) t
|
, MonadCursor (CursorT t (SessionT m)) t
|
||||||
) => MonadPostgres
|
) => MonadPostgres
|
||||||
|
@ -22,7 +22,6 @@ import Data.Tuple.Nested (type (/\), (/\))
|
|||||||
import Effect.Aff.Class (class MonadAff)
|
import Effect.Aff.Class (class MonadAff)
|
||||||
import Effect.Aff.Unlift (class MonadUnliftAff)
|
import Effect.Aff.Unlift (class MonadUnliftAff)
|
||||||
import Effect.Class (class MonadEffect, liftEffect)
|
import Effect.Class (class MonadEffect, liftEffect)
|
||||||
import Effect.Postgres.Error as E
|
|
||||||
import Effect.Unlift (class MonadUnliftEffect)
|
import Effect.Unlift (class MonadUnliftEffect)
|
||||||
|
|
||||||
data Move
|
data Move
|
||||||
@ -119,7 +118,7 @@ instance (MonadSession m) => MonadCursor (CursorT t m) t where
|
|||||||
RowsAffected n' <- query $ ("move relative $1 from " <> cur) /\ n
|
RowsAffected n' <- query $ ("move relative $1 from " <> cur) /\ n
|
||||||
pure n'
|
pure n'
|
||||||
|
|
||||||
instance (MonadThrow E.E m, MonadSession m) => MonadSession (CursorT t m) where
|
instance (MonadSession m) => MonadSession (CursorT t m) where
|
||||||
query = lift <<< query
|
query = lift <<< query
|
||||||
exec = lift <<< exec
|
exec = lift <<< exec
|
||||||
exec_ = lift <<< exec_
|
exec_ = lift <<< exec_
|
||||||
|
@ -2,7 +2,7 @@ module Control.Monad.Postgres.Session where
|
|||||||
|
|
||||||
import Prelude hiding (join)
|
import Prelude hiding (join)
|
||||||
|
|
||||||
import Control.Monad.Error.Class (class MonadError, class MonadThrow, catchError, throwError)
|
import Control.Monad.Error.Class (class MonadError, catchError, throwError)
|
||||||
import Control.Monad.Fork.Class (class MonadBracket)
|
import Control.Monad.Fork.Class (class MonadBracket)
|
||||||
import Control.Monad.Morph (hoist)
|
import Control.Monad.Morph (hoist)
|
||||||
import Control.Monad.Reader (ask)
|
import Control.Monad.Reader (ask)
|
||||||
@ -17,6 +17,7 @@ import Effect.Aff.Postgres.Client (Client)
|
|||||||
import Effect.Aff.Postgres.Client as Client
|
import Effect.Aff.Postgres.Client as Client
|
||||||
import Effect.Aff.Postgres.Pool (Pool)
|
import Effect.Aff.Postgres.Pool (Pool)
|
||||||
import Effect.Aff.Postgres.Pool as Pool
|
import Effect.Aff.Postgres.Pool as Pool
|
||||||
|
import Effect.Aff.Unlift (class MonadUnliftAff)
|
||||||
import Effect.Class (class MonadEffect, liftEffect)
|
import Effect.Class (class MonadEffect, liftEffect)
|
||||||
import Effect.Exception as Effect
|
import Effect.Exception as Effect
|
||||||
import Effect.Postgres.Error (RE)
|
import Effect.Postgres.Error (RE)
|
||||||
@ -44,7 +45,7 @@ instance MonadStartSession Client where
|
|||||||
endSession _ _ = pure unit
|
endSession _ _ = pure unit
|
||||||
|
|
||||||
-- | A monad representing a connected session to a database
|
-- | A monad representing a connected session to a database
|
||||||
class (MonadThrow E.E m, MonadAff m) <= MonadSession m where
|
class MonadAff m <= MonadSession m where
|
||||||
-- | Executes a query and unmarshals the result into `r`
|
-- | Executes a query and unmarshals the result into `r`
|
||||||
query :: forall q r. AsQuery q => FromRows r => q -> m r
|
query :: forall q r. AsQuery q => FromRows r => q -> m r
|
||||||
-- | Executes a query and returns the number of rows affected
|
-- | Executes a query and returns the number of rows affected
|
||||||
@ -70,7 +71,7 @@ class (MonadThrow E.E m, MonadAff m) <= MonadSession m where
|
|||||||
-- | ```
|
-- | ```
|
||||||
streamOut :: String -> m (Readable ())
|
streamOut :: String -> m (Readable ())
|
||||||
|
|
||||||
instance (MonadStartSession s, MonadBracket Effect.Error f m, MonadAff m) => MonadSession (RE s m) where
|
instance (MonadStartSession s, MonadAff m) => MonadSession (RE s m) where
|
||||||
query q = do
|
query q = do
|
||||||
pool <- ask
|
pool <- ask
|
||||||
client <- hoist liftAff $ RE.liftExcept $ startSession pool
|
client <- hoist liftAff $ RE.liftExcept $ startSession pool
|
||||||
|
@ -3,6 +3,7 @@ module Effect.Postgres.Error.RE where
|
|||||||
import Prelude hiding (join)
|
import Prelude hiding (join)
|
||||||
|
|
||||||
import Control.Alt (class Alt)
|
import Control.Alt (class Alt)
|
||||||
|
import Control.Alternative (class Alternative, class Plus)
|
||||||
import Control.Monad.Base (class MonadBase)
|
import Control.Monad.Base (class MonadBase)
|
||||||
import Control.Monad.Error.Class (class MonadError, class MonadThrow, catchError, liftEither, throwError)
|
import Control.Monad.Error.Class (class MonadError, class MonadThrow, catchError, liftEither, throwError)
|
||||||
import Control.Monad.Except (ExceptT, runExceptT)
|
import Control.Monad.Except (ExceptT, runExceptT)
|
||||||
@ -33,7 +34,7 @@ newtype RE r m a = RE (ReaderT r (ExceptT E m) a)
|
|||||||
|
|
||||||
newtype ParRE r f a = ParRE (ReaderT r (Compose f (Either E)) a)
|
newtype ParRE r f a = ParRE (ReaderT r (Compose f (Either E)) a)
|
||||||
|
|
||||||
finally :: forall r f m a. MonadBracket Effect.Error f m => RE r m Unit -> RE r m a -> RE r m a
|
finally :: forall r m a. Monad m => RE r m Unit -> RE r m a -> RE r m a
|
||||||
finally after m = (m <* after) `catchError` \e -> after *> throwError e
|
finally after m = (m <* after) `catchError` \e -> after *> throwError e
|
||||||
|
|
||||||
run :: forall m r a. MonadThrow Effect.Error m => RE r m a -> r -> m a
|
run :: forall m r a. MonadThrow Effect.Error m => RE r m a -> r -> m a
|
||||||
@ -52,6 +53,9 @@ derive instance Newtype (ParRE r m a) _
|
|||||||
derive newtype instance Functor m => Functor (ParRE r m)
|
derive newtype instance Functor m => Functor (ParRE r m)
|
||||||
derive newtype instance Apply m => Apply (ParRE r m)
|
derive newtype instance Apply m => Apply (ParRE r m)
|
||||||
derive newtype instance Applicative m => Applicative (ParRE r m)
|
derive newtype instance Applicative m => Applicative (ParRE r m)
|
||||||
|
derive newtype instance Alt m => Alt (ParRE r m)
|
||||||
|
derive newtype instance Plus m => Plus (ParRE r m)
|
||||||
|
derive newtype instance Alternative m => Alternative (ParRE r m)
|
||||||
|
|
||||||
derive instance Newtype (RE r m a) _
|
derive instance Newtype (RE r m a) _
|
||||||
derive newtype instance Monad m => MonadAsk r (RE r m)
|
derive newtype instance Monad m => MonadAsk r (RE r m)
|
||||||
@ -67,7 +71,7 @@ derive newtype instance MonadEffect m => MonadEffect (RE r m)
|
|||||||
derive newtype instance MonadAff m => MonadAff (RE r m)
|
derive newtype instance MonadAff m => MonadAff (RE r m)
|
||||||
derive newtype instance MonadRec m => MonadRec (RE r m)
|
derive newtype instance MonadRec m => MonadRec (RE r m)
|
||||||
|
|
||||||
instance Parallel p m => Parallel (ParRE r p) (RE r m) where
|
instance (Monad m, Parallel p m) => Parallel (ParRE r p) (RE r m) where
|
||||||
parallel = wrap <<< parallel <<< unwrap
|
parallel = wrap <<< parallel <<< unwrap
|
||||||
sequential = wrap <<< sequential <<< unwrap
|
sequential = wrap <<< sequential <<< unwrap
|
||||||
|
|
||||||
|
10
src/Node.FS.PinnedVersion.purs
Normal file
10
src/Node.FS.PinnedVersion.purs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
module Node.FS.PinnedVersion where
|
||||||
|
|
||||||
|
import Prelude
|
||||||
|
|
||||||
|
import Effect.Aff (Aff)
|
||||||
|
import Node.Encoding (Encoding(..))
|
||||||
|
import Node.FS.Aff as FS
|
||||||
|
|
||||||
|
foo :: Aff Unit
|
||||||
|
foo = FS.writeTextFile UTF8 "foo" "foo"
|
@ -6,11 +6,10 @@ import Control.Monad.Cont (lift)
|
|||||||
import Control.Monad.Error.Class (class MonadError, class MonadThrow, catchError, throwError)
|
import Control.Monad.Error.Class (class MonadError, class MonadThrow, catchError, throwError)
|
||||||
import Control.Monad.Morph (hoist)
|
import Control.Monad.Morph (hoist)
|
||||||
import Control.Monad.Postgres (PostgresT)
|
import Control.Monad.Postgres (PostgresT)
|
||||||
import Control.Monad.Reader (class MonadAsk, ask)
|
import Control.Monad.Reader (ask)
|
||||||
import Data.Maybe (Maybe(..))
|
import Data.Maybe (Maybe(..))
|
||||||
import Effect.Aff.Class (class MonadAff, liftAff)
|
import Effect.Aff.Class (class MonadAff, liftAff)
|
||||||
import Effect.Aff.Postgres.Client as Client
|
import Effect.Aff.Postgres.Client as Client
|
||||||
import Effect.Aff.Postgres.Pool (Pool)
|
|
||||||
import Effect.Aff.Postgres.Pool as Pool
|
import Effect.Aff.Postgres.Pool as Pool
|
||||||
import Effect.Class (liftEffect)
|
import Effect.Class (liftEffect)
|
||||||
import Effect.Exception (Error)
|
import Effect.Exception (Error)
|
||||||
@ -26,7 +25,6 @@ stdin
|
|||||||
:: forall m
|
:: forall m
|
||||||
. MonadAff m
|
. MonadAff m
|
||||||
=> MonadError Error m
|
=> MonadError Error m
|
||||||
=> MonadAsk Pool m
|
|
||||||
=> String
|
=> String
|
||||||
-> Consumer (Maybe Buffer) (PostgresT m) Unit
|
-> Consumer (Maybe Buffer) (PostgresT m) Unit
|
||||||
stdin q = do
|
stdin q = do
|
||||||
|
Loading…
Reference in New Issue
Block a user