Safe Haskell | None |
---|
Model running.
- model :: AppLiftModel c s => Model c s a -> Controller c s a
- runDB :: s -> c -> Pool -> Model c s () -> IO ()
- query :: (QueryParams ps, QueryResults r) => [String] -> ps -> Model c s [r]
- single :: (QueryParams ps, QueryResults (Only r)) => [String] -> ps -> Model c s (Maybe r)
- singleNoParams :: QueryResults (Only r) => [String] -> Model c s (Maybe r)
- queryNoParams :: QueryResults r => [String] -> Model c s [r]
- processQuery :: (QueryParams q, QueryResults r) => Query -> q -> Model c s (ProcessedQuery r)
- queryProcessed :: QueryResults r => ProcessedQuery r -> Model c s [r]
- exec :: QueryParams ps => [String] -> ps -> Model c s Integer
- newtype Only a = Only {
- fromOnly :: a
Documentation
model :: AppLiftModel c s => Model c s a -> Controller c s aSource
Run a model action from within a controller.
query :: (QueryParams ps, QueryResults r) => [String] -> ps -> Model c s [r]Source
Query with some parameters.
single :: (QueryParams ps, QueryResults (Only r)) => [String] -> ps -> Model c s (Maybe r)Source
Query a single field from a single result.
singleNoParams :: QueryResults (Only r) => [String] -> Model c s (Maybe r)Source
Query a single field from a single result (no params).
queryNoParams :: QueryResults r => [String] -> Model c s [r]Source
Query with no parameters.
processQuery :: (QueryParams q, QueryResults r) => Query -> q -> Model c s (ProcessedQuery r)Source
Process a query for later use.
queryProcessed :: QueryResults r => ProcessedQuery r -> Model c s [r]Source
A version of query
that does not perform query substitution.
exec :: QueryParams ps => [String] -> ps -> Model c s IntegerSource
Execute some SQL returning the rows affected.
newtype Only a
A single-value "collection".
This is useful if you need to supply a single parameter to a SQL query, or extract a single column from a SQL result.
Parameter example:
query c "select x from scores where x > ?" (Only
(42::Int))
Result example:
xs <- query_ c "select id from users"
forM_ xs $ \(Only
id) -> {- ... -}