Safe Haskell | None |
---|---|
Language | Haskell2010 |
This provides one essential function, patchConfig
to replace Spock's default
in-RAM session implementation with a Beam/postgres one.
Synopsis
- patchConfig :: (FromBackendRow Postgres (sessdata Identity), Beamable sessdata, Typeable sessdata, Database Postgres db, UserData (sessdata Identity), FieldsFulfillConstraint (HasSqlValueSyntax PgValueSyntax) sessdata) => DatabaseEntity Postgres db (TableEntity (SessionT sessdata)) -> Pool ReadOnlyConn -> Pool ReadWriteConn -> SpockCfg conn (sessdata Identity) st -> SpockCfg conn (sessdata Identity) st
- class UserData c where
- rememberMe :: c -> Bool
Documentation
patchConfig :: (FromBackendRow Postgres (sessdata Identity), Beamable sessdata, Typeable sessdata, Database Postgres db, UserData (sessdata Identity), FieldsFulfillConstraint (HasSqlValueSyntax PgValueSyntax) sessdata) => DatabaseEntity Postgres db (TableEntity (SessionT sessdata)) -> Pool ReadOnlyConn -> Pool ReadWriteConn -> SpockCfg conn (sessdata Identity) st -> SpockCfg conn (sessdata Identity) st Source #
Update a spock configuration stanza to replace its default session with one backed by postgres. This will typically be used like so:
spockCfg <-patchConfig
(_dbSession db) ropool rwpool $defaultSpockCfg
sess PCNoDatabase ()runSpock
port (spock
spockCfg routes) where sess = ... routes = ...
class UserData c where Source #
Typeclass for user-supplied data. We really just need to know whether the
user has set a remember-me indicator upon login so that the session's
lifespan can be intelligently controlled. If your session never needs to be
remembers, then rememberMe = const False
should suffice.
rememberMe :: c -> Bool Source #
Should the associated session be stored permanently?
Instances
UserData Users Source # | |
Defined in TsWeb.Tables.Session.Test rememberMe :: Users -> Bool Source # |