tsweb-0.1.1: An API binding Web.Spock to Database.Beam

Safe HaskellNone



This provides one essential function, patchConfig to replace Spock's default in-RAM session implementation with a Beam/postgres one.



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)
   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?

UserData Users Source # 
Instance details

Defined in TsWeb.Tables.Session.Test