| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Freckle.App.Database
Description
Database access for your App
Synopsis
- class Monad m => MonadTracer (m :: Type -> Type)
- class HasStatsClient env
- class HasSqlPool app where
- getSqlPool :: app -> SqlPool
- type SqlPool = Pool SqlBackend
- makePostgresPool :: (MonadUnliftIO m, MonadLoggerIO m) => m SqlPool
- makePostgresPoolWith :: (MonadUnliftIO m, MonadLoggerIO m) => PostgresConnectionConf -> m SqlPool
- runDB :: (MonadUnliftIO m, MonadTracer m, MonadReader app m, HasSqlPool app, HasStatsClient app, HasCallStack) => SqlPersistT m a -> m a
- runDBSimple :: (HasSqlPool app, MonadUnliftIO m, MonadReader app m) => SqlPersistT m a -> m a
- data PostgresConnectionConf = PostgresConnectionConf {}
- data PostgresPasswordSource
- data PostgresPassword
- type PostgresStatementTimeout = Timeout
- postgresStatementTimeoutMilliseconds :: PostgresStatementTimeout -> Int
- envParseDatabaseConf :: PostgresPasswordSource -> Parser Error PostgresConnectionConf
- envPostgresPasswordSource :: Parser Error PostgresPasswordSource
Documentation
class Monad m => MonadTracer (m :: Type -> Type) Source #
This is generally scoped by Monad stack to do different things
Minimal complete definition
Instances
| HasTracer app => MonadTracer (AppExample app) Source # | |
Defined in Freckle.App.Test Methods getTracer :: AppExample app Tracer Source # | |
| (Monad m, HasTracer app) => MonadTracer (AppT app m) Source # | |
| MonadTracer m => MonadTracer (IdentityT m) | |
| MonadTracer m => MonadTracer (ReaderT r m) | |
class HasStatsClient env Source #
Minimal complete definition
Instances
| HasStatsClient StatsClient Source # | |
Defined in Freckle.App.Stats Methods | |
| HasStatsClient site => HasStatsClient (HandlerData child site) Source # | |
Defined in Freckle.App.Stats Methods statsClientL :: Lens' (HandlerData child site) StatsClient Source # | |
class HasSqlPool app where Source #
Methods
getSqlPool :: app -> SqlPool Source #
Instances
| HasSqlPool SqlPool Source # | |
Defined in Freckle.App.Database Methods getSqlPool :: SqlPool -> SqlPool Source # | |
| HasSqlPool site => HasSqlPool (HandlerData child site) Source # | |
Defined in Freckle.App.Database Methods getSqlPool :: HandlerData child site -> SqlPool Source # | |
type SqlPool = Pool SqlBackend Source #
makePostgresPool :: (MonadUnliftIO m, MonadLoggerIO m) => m SqlPool Source #
makePostgresPoolWith :: (MonadUnliftIO m, MonadLoggerIO m) => PostgresConnectionConf -> m SqlPool Source #
runDB :: (MonadUnliftIO m, MonadTracer m, MonadReader app m, HasSqlPool app, HasStatsClient app, HasCallStack) => SqlPersistT m a -> m a Source #
Run a Database action with connection stats and tracing
This uses OpenTelemetry and MonadTracer. For callstacks in traces to be
useful, ensure you have HasCallStack on functions that call this (and
functions that call those, for as far as you require to get to a useful
source location).
runDBSimple :: (HasSqlPool app, MonadUnliftIO m, MonadReader app m) => SqlPersistT m a -> m a Source #
data PostgresConnectionConf Source #
Constructors
| PostgresConnectionConf | |
Fields
| |
Instances
| Show PostgresConnectionConf Source # | |
Defined in Freckle.App.Database | |
| Eq PostgresConnectionConf Source # | |
Defined in Freckle.App.Database Methods (==) :: PostgresConnectionConf -> PostgresConnectionConf -> Bool Source # (/=) :: PostgresConnectionConf -> PostgresConnectionConf -> Bool Source # | |
data PostgresPasswordSource Source #
Instances
| Show PostgresPasswordSource Source # | |
Defined in Freckle.App.Database | |
| Eq PostgresPasswordSource Source # | |
Defined in Freckle.App.Database Methods (==) :: PostgresPasswordSource -> PostgresPasswordSource -> Bool Source # (/=) :: PostgresPasswordSource -> PostgresPasswordSource -> Bool Source # | |
data PostgresPassword Source #
Constructors
| PostgresPasswordIamAuth | |
| PostgresPasswordStatic String |
Instances
| Show PostgresPassword Source # | |
Defined in Freckle.App.Database | |
| Eq PostgresPassword Source # | |
Defined in Freckle.App.Database Methods (==) :: PostgresPassword -> PostgresPassword -> Bool Source # (/=) :: PostgresPassword -> PostgresPassword -> Bool Source # | |
type PostgresStatementTimeout = Timeout Source #