Module
Control.Monad.Postgres.Cursor
- Package
- purescript-postgresql
- Repository
- cakekindel/purescript-postgresql
#CursorT Source
newtype CursorT :: forall k. Type -> (k -> Type) -> k -> Typenewtype CursorT t m a
Constructors
Instances
Newtype (CursorT t m a) _(Functor m) => Functor (CursorT t m)(Apply m) => Apply (CursorT t m)(Applicative m) => Applicative (CursorT t m)(Plus m) => Plus (CursorT t m)(Alt m) => Alt (CursorT t m)(Alternative m) => Alternative (CursorT t m)(Bind m) => Bind (CursorT t m)(Monad m) => Monad (CursorT t m)(MonadEffect m) => MonadEffect (CursorT t m)(MonadAff m) => MonadAff (CursorT t m)(MonadRec m) => MonadRec (CursorT t m)(MonadUnliftEffect m) => MonadUnliftEffect (CursorT t m)(MonadUnliftAff m) => MonadUnliftAff (CursorT t m)MonadTrans (CursorT t)(MonadThrow e m) => MonadThrow e (CursorT t m)(MonadError e m) => MonadError e (CursorT t m)(MonadFork f m) => MonadFork f (CursorT t m)(Monad m, MonadKill e f m) => MonadKill e f (CursorT t m)(Monad m, MonadBracket e f (ReaderT String m), MonadBracket e f m) => MonadBracket e f (CursorT t m)(Monad m) => MonadAsk (Tuple String (Array Raw -> RepT t)) (CursorT t m)(Monad m) => MonadReader (Tuple String (Array Raw -> RepT t)) (CursorT t m)(Apply m, Apply p, Parallel p m) => Parallel (CursorT t p) (CursorT t m)(MonadSession m) => MonadCursor (CursorT t m) t(MonadSession m) => MonadSession (CursorT t m)
#MonadCursor Source
class MonadCursor :: (Type -> Type) -> Type -> Constraintclass (MonadSession m) <= MonadCursor m t where
A monad representing a handle to a server-side cursor
runPostgres {connectionString: "..."} do
exec_ "create table foo (id int not null primary key);"
exec_
$ intercalate "\n "
[ "insert into foo (id)"
, "values"
, intercalate ", "
$ map (\n -> "(" <> show n <> ")")
$ Array.range 1 100
]
cursor @Int "foo_cursor" "select id from foo" do
a <- fetchOne -- 1
b <- fetchOne -- 2
c <- fetchOne -- 3
d <- fetch 10 -- 4..14
e <- fetchAll -- 15..100
pure unit
Members
fetch :: Int -> m (Array t)Fetch a specified number of rows from the cursor
fetchAll :: m (Array t)Fetch all remaining rows from the cursor
move :: Move -> m IntChange the cursor's position without fetching any data, returning the number of rows skipped.
Instances
(MonadSession m) => MonadCursor (CursorT t m) t
#fetchOne Source
fetchOne :: forall m t. MonadCursor m t => m (Maybe t)Fetch the next row from the cursor
- 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
MOVE RELATIVE