yesod-session-persist-0.0.0.2: SQL session backend for Yesod
Safe HaskellSafe-Inferred
LanguageGHC2021

Yesod.Session.Persist.Storage

Synopsis

Documentation

persistentStorage :: forall record backend result m. (PersistRecordBackend record backend, PersistStoreWrite backend) => SessionPersistence backend record m -> StorageOperation result -> ReaderT backend IO result Source #

data SessionPersistence backend record m Source #

Mapping between Session and a Persistent entity of your choice

Constructors

(PersistRecordBackend record backend, PersistStoreWrite backend, SafeToInsert record) => SessionPersistence 

Fields

Persistent reëxports

class (PersistField (Key record), ToJSON (Key record), FromJSON (Key record), Show (Key record), Read (Key record), Eq (Key record), Ord (Key record)) => PersistEntity record #

Persistent serialized Haskell records to the database. A Database Entity (A row in SQL, a document in MongoDB, etc) corresponds to a Key plus a Haskell record.

For every Haskell record type stored in the database there is a corresponding PersistEntity instance. An instance of PersistEntity contains meta-data for the record. PersistEntity also helps abstract over different record types. That way the same query interface can return a PersistEntity, with each query returning different types of Haskell records.

Some advanced type system capabilities are used to make this process type-safe. Persistent users usually don't need to understand the class associated data and functions.

type family PersistEntityBackend record #

Persistent allows multiple different backends (databases).

class SafeToInsert a #

A type class which is used to witness that a type is safe to insert into the database without providing a primary key.

The TemplateHaskell function mkPersist will generate instances of this class for any entity that it works on. If the entity has a default primary key, then it provides a regular instance. If the entity has a Primary natural key, then this works fine. But if the entity has an Id column with no default=, then this does a TypeError and forces the user to use insertKey.

Since: persistent-2.14.0.0

Instances

Instances details
(TypeError (EntityErrorMessage a) :: Constraint) => SafeToInsert (Entity a) 
Instance details

Defined in Database.Persist.Class.PersistEntity

(TypeError (FunctionErrorMessage a b) :: Constraint) => SafeToInsert (a -> b) 
Instance details

Defined in Database.Persist.Class.PersistEntity