Module
Control.Monad.Postgres.Session
- Package
- purescript-postgresql
- Repository
- cakekindel/purescript-postgresql
#MonadStartSession Source
class MonadStartSession a where
Members
startSession :: a -> Except Aff Client
endSession :: a -> Client -> Except Effect Unit
Instances
#MonadSession Source
class MonadSession :: (Type -> Type) -> Constraint
class (MonadAff m) <= MonadSession m where
A monad representing a connected session to a database
Members
query :: forall q r. AsQuery q => FromRows r => q -> m r
exec :: forall q. AsQuery q => q -> m Int
Executes a query and returns the number of rows affected
exec_ :: forall q. AsQuery q => q -> m Unit
Executes a query and discards the result
streamIn :: String -> m (Writable ())
Execute a query with a
Writable
stream toSTDIN
Use with
COPY .. FROM
like so:w <- streamIn "COPY foo FROM STDIN WITH (FORMAT CSV, HEADER true)" liftEffect $ Stream.writeString "bar\n\"my bar column\"" UTF8 w
streamOut :: String -> m (Readable ())
Execute a query with a
Readable
stream fromSTDOUT
Use with
COPY .. TO
like so:r <- streamIn "COPY foo TO STDIN WITH (FORMAT CSV, HEADER true)" liftEffect $ Stream.readString r -- "bar\n\"my bar column\""
Instances
(MonadStartSession s, MonadAff m) => MonadSession (RE s m)
#handleStream Source
handleStream :: forall e m r. MonadEffect m => MonadError e m => Effect Unit -> m (Stream r) -> m (Stream r)
- Modules
- Control.
Monad. Postgres - Control.
Monad. Postgres. Base - Control.
Monad. Postgres. Cursor - Control.
Monad. Postgres. Session - Data.
Postgres - Data.
Postgres. Custom - Data.
Postgres. Custom. Enum - Data.
Postgres. Interval - Data.
Postgres. Query - Data.
Postgres. Query. Builder - Data.
Postgres. Range - Data.
Postgres. Raw - Data.
Postgres. Result - Data.
Postgres. Unresult - Effect.
Aff. Postgres. Client - Effect.
Aff. Postgres. Pool - Effect.
Postgres. Client - Effect.
Postgres. Error - Effect.
Postgres. Error. Common - Effect.
Postgres. Error. Except - Effect.
Postgres. Error. RE - Effect.
Postgres. Pool - Node.
FS. PinnedVersion - Pipes.
Postgres
Executes a query and unmarshals the result into
r