-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | persistent snaplet for the Snap Framework -- @package snaplet-persistent @version 0.4.1 module Snap.Snaplet.Persistent -- | Initialize Persistent with an initial SQL function called right after -- the connection pool has been created. This is most useful for calling -- migrations upfront right after initialization. -- -- Example: -- --
--   initPersist (runMigrationUnsafe migrateAll)
--   
-- -- where migrateAll is the migration function that was auto-generated by -- the QQ statement in your persistent schema definition in the call to -- mkMigrate. initPersist :: SqlPersistT (NoLoggingT IO) a -> SnapletInit b PersistState -- | Backend-agnostic initalization with an initial SQL function called -- right after the connection pool has been created. This is most useful -- for calling migrations upfront right after initialization. -- -- Example: -- --
--   initPersist mkPool (runMigrationUnsafe migrateAll)
--   
-- -- where migrateAll is the migration function that was auto-generated by -- the QQ statement in your persistent schema definition in the call to -- mkMigrate. -- -- mkPool is a function to construct a pool of connections to your -- database initPersistGeneric :: Initializer b PersistState (Pool Connection) -> SqlPersistT (NoLoggingT IO) a -> SnapletInit b PersistState newtype PersistState PersistState :: ConnectionPool -> PersistState persistPool :: PersistState -> ConnectionPool -- | Implement this type class to have any monad work with -- snaplet-persistent. A default instance is provided for (Handler b -- PersistState). class MonadIO m => HasPersistPool m getPersistPool :: HasPersistPool m => m ConnectionPool -- | Constructs a connection pool from Config. mkPgPool :: MonadIO m => Config -> m ConnectionPool -- | Conscruts a connection pool in a snaplet context. mkSnapletPgPool :: (MonadIO (m b v), MonadSnaplet m) => m b v ConnectionPool -- | Runs a SqlPersist action in any monad with a HasPersistPool instance. runPersist :: HasPersistPool m => SqlPersistT (ResourceT (NoLoggingT IO)) b -> m b -- | Run a database action withPool :: MonadIO m => ConnectionPool -> SqlPersistT (ResourceT (NoLoggingT IO)) a -> m a -- | Make a Key from an Int. mkKey :: Int -> Key entity -- | Makes a Key from a ByteString. Calls error on failure. mkKeyBS :: ByteString -> Key entity -- | Makes a Key from Text. Calls error on failure. mkKeyT :: Text -> Key entity -- | Makes a Text representation of a Key. showKey :: Key e -> Text -- | Makes a ByteString representation of a Key. showKeyBS :: Key e -> ByteString -- | Converts a Key to Int. Fails with error if the conversion fails. mkInt :: Key a -> Int -- | Converts a Key to Word64. Fails with error if the conversion fails. mkWord64 :: Key a -> Word64 -- | Follows a foreign key field in one entity and retrieves the -- corresponding entity from the database. followForeignKey :: (PersistEntity a, HasPersistPool m, PersistEntityBackend a ~ SqlBackend) => (t -> Key a) -> Entity t -> m (Maybe (Entity a)) fromPersistValue' :: PersistField c => PersistValue -> c instance MonadIO m => HasPersistPool (ReaderT ConnectionPool m) instance HasPersistPool (Handler b PersistState) instance HasPersistPool m => HasPersistPool (NoLoggingT m) module Snap.Snaplet.Auth.Backends.Persistent data PersistAuthManager -- | Initializer that gets AuthSettings from a config file. initPersistAuthManager :: SnapletLens b SessionManager -> ConnectionPool -> SnapletInit b (AuthManager b) -- | Initializer that lets you specify AuthSettings. initPersistAuthManager' :: AuthSettings -> SnapletLens b SessionManager -> ConnectionPool -> SnapletInit b (AuthManager b) -- | The list of entity definitions this snaplet exposes. You need them so -- that you can append to your application's list of entity definitions -- and perform the migration in one block. -- -- See how this example combined an app's own entity definitions and the -- auth snaplet's in one migration block: -- --
--   share [mkMigrate "migrateAll"] $
--      authEntityDefs ++
--      $(persistFileWith lowerCaseSettings "schema.txt")
--   
authEntityDefs :: [EntityDef SqlType] data SnapAuthUserGeneric backend SnapAuthUser :: !Text -> !Text -> !Text -> !(Maybe UTCTime) -> !(Maybe UTCTime) -> !(Maybe Text) -> !Int -> !Int -> !(Maybe UTCTime) -> !(Maybe UTCTime) -> !(Maybe UTCTime) -> !(Maybe Text) -> !(Maybe Text) -> !UTCTime -> !UTCTime -> !(Maybe Text) -> !(Maybe UTCTime) -> !String -> !String -> SnapAuthUserGeneric backend snapAuthUserLogin :: SnapAuthUserGeneric backend -> !Text snapAuthUserEmail :: SnapAuthUserGeneric backend -> !Text snapAuthUserPassword :: SnapAuthUserGeneric backend -> !Text snapAuthUserActivatedAt :: SnapAuthUserGeneric backend -> !(Maybe UTCTime) snapAuthUserSuspendedAt :: SnapAuthUserGeneric backend -> !(Maybe UTCTime) snapAuthUserRememberToken :: SnapAuthUserGeneric backend -> !(Maybe Text) snapAuthUserLoginCount :: SnapAuthUserGeneric backend -> !Int snapAuthUserFailedLoginCount :: SnapAuthUserGeneric backend -> !Int snapAuthUserLockedOutUntil :: SnapAuthUserGeneric backend -> !(Maybe UTCTime) snapAuthUserCurrentLoginAt :: SnapAuthUserGeneric backend -> !(Maybe UTCTime) snapAuthUserLastLoginAt :: SnapAuthUserGeneric backend -> !(Maybe UTCTime) snapAuthUserCurrentIp :: SnapAuthUserGeneric backend -> !(Maybe Text) snapAuthUserLastIp :: SnapAuthUserGeneric backend -> !(Maybe Text) snapAuthUserCreatedAt :: SnapAuthUserGeneric backend -> !UTCTime snapAuthUserUpdatedAt :: SnapAuthUserGeneric backend -> !UTCTime snapAuthUserResetToken :: SnapAuthUserGeneric backend -> !(Maybe Text) snapAuthUserResetRequestedAt :: SnapAuthUserGeneric backend -> !(Maybe UTCTime) snapAuthUserRoles :: SnapAuthUserGeneric backend -> !String snapAuthUserMeta :: SnapAuthUserGeneric backend -> !String type SnapAuthUser = SnapAuthUserGeneric SqlBackend type SnapAuthUserId = KeyBackend SqlBackend SnapAuthUser migrateAuth :: (MonadBaseControl IO m, MonadIO m, MonadLogger m) => Migration (SqlPersistT m) -- | Function to convert a SnapAuthUser entity into the auth -- snaplet's AuthUser. db2au :: Entity SnapAuthUser -> AuthUser -- | Splices for SnapAuthUser that are equivalent to the ones for -- AuthUser. dbUserSplices :: Monad n => Splices (RuntimeSplice n (Entity SnapAuthUser) -> Splice n) -- | Get the db key from an AuthUser userDBKey :: AuthUser -> Maybe SnapAuthUserId textPassword :: Password -> Text instance IAuthBackend PersistAuthManager