groundhog-postgresql-0.7.0.1: PostgreSQL backend for the groundhog library.

Safe HaskellNone
LanguageHaskell98

Database.Groundhog.Postgresql

Synopsis

Documentation

withPostgresqlPool Source

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> String

connection string

-> Int

number of connections to open

-> (Pool Postgresql -> m a) 
-> m a 

withPostgresqlConn Source

Arguments

:: (MonadBaseControl IO m, MonadIO m) 
=> String

connection string

-> (Postgresql -> m a) 
-> m a 

createPostgresqlPool Source

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.

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).