Safe Haskell | None |
---|---|
Language | Haskell98 |
Database.Groundhog.Postgresql
- withPostgresqlPool :: (MonadBaseControl IO m, MonadIO m) => String -> Int -> (Pool Postgresql -> m a) -> m a
- withPostgresqlConn :: (MonadBaseControl IO m, MonadIO m) => String -> (Postgresql -> m a) -> m a
- createPostgresqlPool :: MonadIO m => String -> Int -> m (Pool Postgresql)
- runDbConn :: (MonadBaseControl IO m, MonadIO m, ConnectionManager cm conn) => DbPersist conn (NoLoggingT m) a -> cm -> m a
- newtype Postgresql = Postgresql Connection
- module Database.Groundhog
- module Database.Groundhog.Generic.Sql.Functions
- explicitType :: (Expression Postgresql r a, PersistField a) => a -> Expr Postgresql r a
- castType :: Expression Postgresql r a => a -> String -> Expr Postgresql r a
- distinctOn :: (db ~ Postgresql, HasSelectOptions a db r, HasDistinct a ~ HFalse, Projection' p db r p') => a -> p -> SelectOptions db r (HasLimit a) (HasOffset a) (HasOrder a) HTrue
- showSqlType :: DbTypePrimitive -> String
Documentation
Arguments
:: (MonadBaseControl IO m, MonadIO m) | |
=> String | connection string |
-> Int | number of connections to open |
-> (Pool Postgresql -> m a) | |
-> m a |
Arguments
:: (MonadBaseControl IO m, MonadIO m) | |
=> String | connection string |
-> (Postgresql -> m a) | |
-> m a |
Arguments
:: MonadIO m | |
=> String | connection string |
-> Int | number of connections to open |
-> m (Pool Postgresql) |
runDbConn :: (MonadBaseControl IO m, MonadIO m, ConnectionManager cm conn) => DbPersist conn (NoLoggingT m) a -> cm -> m a
Runs action within connection. It can handle a simple connection, a pool of them, etc.
newtype Postgresql Source
Constructors
Postgresql Connection |
Instances
module Database.Groundhog
explicitType :: (Expression Postgresql r a, PersistField a) => a -> Expr Postgresql r a Source
Put explicit type for expression. It is useful for values which are defaulted to a wrong type. For example, a literal Int from a 64bit machine can be defaulted to a 32bit int by Postgresql. Also a value entered as an external string (geometry, arrays and other complex types have this representation) may need an explicit type.
castType :: Expression Postgresql r a => a -> String -> Expr Postgresql r a Source
Casts expression to a type. castType value "INT"
results in value::INT
.
distinctOn :: (db ~ Postgresql, HasSelectOptions a db r, HasDistinct a ~ HFalse, Projection' p db r p') => a -> p -> SelectOptions db r (HasLimit a) (HasOffset a) (HasOrder a) HTrue Source
Distinct only on certain fields or expressions. For example, select $ CondEmpty
.distinctOn
(lower EmailField, IpField)