Spock-session-postgresql
Safe HaskellNone
LanguageHaskell2010

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

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

Instances details
Applicative PostgresqlTx Source # 
Instance details

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 # 
Instance details

Defined in Web.Spock.Session.Postgresql

Methods

fmap :: (a -> b) -> PostgresqlTx a -> PostgresqlTx b

(<$) :: a -> PostgresqlTx b -> PostgresqlTx a

Monad PostgresqlTx Source # 
Instance details

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

  • psc_namespace :: Text

    Independent applications must use different namespaces.

  • psc_maxRetries :: Int

    Maximum retries for serialization failures or deadlocks. Other errors propagate immediately. Exhaustion propagates the last SQL exception.

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

Instances details
Eq SessionDecodeError Source # 
Instance details

Defined in Web.Spock.Session.Postgresql

Exception SessionDecodeError Source # 
Instance details

Defined in Web.Spock.Session.Postgresql

Methods

toException :: SessionDecodeError -> SomeException

fromException :: SomeException -> Maybe SessionDecodeError

displayException :: SessionDecodeError -> String

backtraceDesired :: SessionDecodeError -> Bool

Show SessionDecodeError Source # 
Instance details

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.