| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Web.Spock.Session.Postgresql
Description
An optional persistent session store. Initialize the schema once before starting workers, then share a namespace across workers using the same session data type. The caller owns the connection pool.
Synopsis
- data PostgresqlTx a
- data PostgresqlSessionCfg = PostgresqlSessionCfg {}
- defaultPostgresqlSessionCfg :: PostgresqlSessionCfg
- data SessionDecodeError = SessionDecodeError
- initializePostgresqlSessions :: Connection -> IO ()
- newPostgresqlSessionStore :: (ToJSON sess, FromJSON sess) => PostgresqlSessionCfg -> Pool Connection -> IO (SessionStore (Session conn sess st) PostgresqlTx)
Documentation
data PostgresqlTx a Source #
Deliberately has no MonadIO instance: the whole transaction can be retried, so callbacks must not perform external side effects.
Instances
| Applicative PostgresqlTx Source # | |
Defined in Web.Spock.Session.Postgresql Methods pure :: a -> PostgresqlTx a (<*>) :: PostgresqlTx (a -> b) -> PostgresqlTx a -> PostgresqlTx b liftA2 :: (a -> b -> c) -> PostgresqlTx a -> PostgresqlTx b -> PostgresqlTx c (*>) :: PostgresqlTx a -> PostgresqlTx b -> PostgresqlTx b (<*) :: PostgresqlTx a -> PostgresqlTx b -> PostgresqlTx a | |
| Functor PostgresqlTx Source # | |
Defined in Web.Spock.Session.Postgresql Methods fmap :: (a -> b) -> PostgresqlTx a -> PostgresqlTx b (<$) :: a -> PostgresqlTx b -> PostgresqlTx a | |
| Monad PostgresqlTx Source # | |
Defined in Web.Spock.Session.Postgresql Methods (>>=) :: PostgresqlTx a -> (a -> PostgresqlTx b) -> PostgresqlTx b (>>) :: PostgresqlTx a -> PostgresqlTx b -> PostgresqlTx b return :: a -> PostgresqlTx a | |
data PostgresqlSessionCfg Source #
Constructors
| PostgresqlSessionCfg | |
Fields
| |
data SessionDecodeError Source #
Stored JSON cannot be decoded as the application's session type. No stored content is included in this exception.
Constructors
| SessionDecodeError |
Instances
| Eq SessionDecodeError Source # | |
Defined in Web.Spock.Session.Postgresql Methods (==) :: SessionDecodeError -> SessionDecodeError -> Bool (/=) :: SessionDecodeError -> SessionDecodeError -> Bool | |
| Exception SessionDecodeError Source # | |
Defined in Web.Spock.Session.Postgresql Methods toException :: SessionDecodeError -> SomeException fromException :: SomeException -> Maybe SessionDecodeError displayException :: SessionDecodeError -> String backtraceDesired :: SessionDecodeError -> Bool | |
| Show SessionDecodeError Source # | |
Defined in Web.Spock.Session.Postgresql Methods showsPrec :: Int -> SessionDecodeError -> ShowS show :: SessionDecodeError -> String showList :: [SessionDecodeError] -> ShowS | |
initializePostgresqlSessions :: Connection -> IO () Source #
Create the adapter's table. Run once during deployment/startup, before concurrent workers. All ordinary operations are scoped to a namespace.
newPostgresqlSessionStore :: (ToJSON sess, FromJSON sess) => PostgresqlSessionCfg -> Pool Connection -> IO (SessionStore (Session conn sess st) PostgresqlTx) Source #