seakale-0.1.0.0: Pure SQL layer on top of other libraries

Safe HaskellNone
LanguageHaskell2010

Database.Seakale.Request

Synopsis

Documentation

query :: (MonadRequest b m, ToRow b n r, FromRow b n' s) => Query n -> r -> m [s] Source #

Replace holes in the query with the provided values and send it to the database. This is to be used for SELECT queries.

query_ :: (MonadRequest b m, FromRow b n r) => Query Zero -> m [r] Source #

Like query but the query should not have any hole.

queryWith :: (MonadRequest b m, ToRow b n r) => RowParser b n' s -> Query n -> r -> m [s] Source #

Provide a way to specify a custom parser for query.

execute :: (MonadRequest b m, ToRow b n r) => Query n -> r -> m Integer Source #

Replace holes in the query with the provided values, send it to the database and return the number of rows affected. This is to be used with DELETE, UPDATE and INSERT queries (without any RETURNING clause).

execute_ :: MonadRequest b m => Query Zero -> m Integer Source #

Like execute but the query should not have any hole.

executeMany :: (MonadRequest b m, ToRow b n1 r1, ToRow b n2 r2, ToRow b n3 r3) => RepeatQuery n1 n2 n3 -> r1 -> r3 -> [r2] -> m Integer Source #

Like execute but for a RepeatQuery where a piece of the query is repeated as many times as the number of values of type r2.

executeMany_ :: (MonadRequest b m, ToRow b n r) => RepeatQuery Zero n Zero -> [r] -> m Integer Source #

Like executeMany but the query should not have any hole before and after the repeating piece.

returning :: (MonadRequest b m, ToRow b n1 r1, ToRow b n2 r2, ToRow b n3 r3, FromRow b n s) => RepeatQuery n1 n2 n3 -> r1 -> r3 -> [r2] -> m [s] Source #

Replace holes in a RepeatQuery and send it to the database. This is to be used for INSERT queries with a RETURNING clause.

returningWith :: (MonadRequest b m, ToRow b n1 r1, ToRow b n2 r2, ToRow b n3 r3, FromRow b n s) => RowParser b n s -> RepeatQuery n1 n2 n3 -> r1 -> r3 -> [r2] -> m [s] Source #

Provide a way to a custom parser for returning.

returning_ :: (MonadRequest b m, ToRow b n r, FromRow b n' s) => RepeatQuery Zero n Zero -> [r] -> m [s] Source #

Like returning but the query should not have any hole before and after the repeating piece.

returningWith_ :: (MonadRequest b m, ToRow b n r, FromRow b n' s) => RowParser b n' s -> RepeatQuery Zero n Zero -> [r] -> m [s] Source #

Like returningWith but the query should not have any hole before and after the repeating piece.

class MonadSeakaleBase backend m => MonadRequest backend m Source #

Minimal complete definition

query, execute

Instances

(MonadRequest backend m, MonadTrans t, MonadSeakaleBase backend (t m)) => MonadRequest backend (t m) Source # 

Methods

query :: ByteString -> t m ([ColumnInfo backend], [Row backend]) Source #

execute :: ByteString -> t m Integer Source #

Monad m => MonadRequest backend (FreeT (RequestF backend) m) Source # 

Methods

query :: ByteString -> FreeT (RequestF backend) m ([ColumnInfo backend], [Row backend]) Source #

execute :: ByteString -> FreeT (RequestF backend) m Integer Source #

getBackend :: MonadSeakaleBase backend m => m backend Source #