Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Web.ServerSession.Backend.Persistent.Internal.Impl
Description
Internal module exposing the guts of the package. Use at your own risk. No API stability guarantees apply.
Synopsis
- data PersistentSession sess = PersistentSession {}
- type PersistentSessionId sess = Key (PersistentSession sess)
- data family EntityField record :: Type -> Type
- serverSessionDefsBySessionMap :: [UnboundEntityDef]
- type PersistentSessionBySessionMap = PersistentSession SessionMap
- mkServerSessionDefs :: forall sess. PersistEntity sess => Proxy sess -> Text -> [UnboundEntityDef]
- psKey :: SessionId sess -> Key (PersistentSession sess)
- toPersistentSession :: Session sess -> PersistentSession sess
- fromPersistentSession :: PersistentSession sess -> Session sess
- newtype SqlStorage sess = SqlStorage {}
- throwSS :: Storage (SqlStorage sess) => StorageException (SqlStorage sess) -> TransactionM (SqlStorage sess) a
Documentation
data PersistentSession sess Source #
Entity corresponding to a Session
.
We're bending persistent
in ways it wasn't expected to. In
particular, this entity is parametrized over the session type.
Constructors
PersistentSession | |
Fields
|
Instances
type PersistentSessionId sess = Key (PersistentSession sess) Source #
data family EntityField record :: Type -> Type #
An EntityField
is parameterised by the Haskell record it belongs to
and the additional type of that field.
As of persistent-2.11.0.0
, it's possible to use the OverloadedLabels
language extension to refer to EntityField
values polymorphically. See
the documentation on SymbolToField
for more information.
Instances
SymbolToField sym rec typ => IsLabel sym (EntityField rec typ) | This instance delegates to Since: persistent-2.11.0.0 |
Defined in Database.Persist.Class.PersistEntity Methods fromLabel :: EntityField rec typ # | |
data EntityField (PersistentSession sess) typ Source # | |
Defined in Web.ServerSession.Backend.Persistent.Internal.Impl data EntityField (PersistentSession sess) typ
|
serverSessionDefsBySessionMap :: [UnboundEntityDef] Source #
Simple version.
Entity definitions needed to generate the SQL schema for SqlStorage
.
Example:
mkMigrate "migrateAll" serverSessionDefsBySessionMap
Note: Also import PersistentSessionBySessionMap
in the same module.
mkServerSessionDefs :: forall sess. PersistEntity sess => Proxy sess -> Text -> [UnboundEntityDef] Source #
Entity definitions needed to generate the SQL schema for SqlStorage
.
Generate schema by specifying Haskell name in Text.
Example using SessionMap
:
type PersistentSessionBySessionMap = PersistentSession SessionMap mkMigrate "migrateAll" (mkServerSessionDefs (Proxy :: Proxy PersistentSessionBySessionMap) "PersistentSessionBySessionMap")
psKey :: SessionId sess -> Key (PersistentSession sess) Source #
Generate a key to the entity from the session ID.
toPersistentSession :: Session sess -> PersistentSession sess Source #
Convert from Session
to PersistentSession
.
fromPersistentSession :: PersistentSession sess -> Session sess Source #
Convert from PersistentSession
to Session
.
newtype SqlStorage sess Source #
SQL session storage backend using persistent
.
Constructors
SqlStorage | |
Fields
|
Instances
throwSS :: Storage (SqlStorage sess) => StorageException (SqlStorage sess) -> TransactionM (SqlStorage sess) a Source #
Specialization of throwIO
for SqlStorage
.