Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Only a = Only {
- fromOnly :: a
- newtype Binary a = Binary {
- fromBinary :: a
- mandatory :: (MonadDb m, ToRow a, FromRow b) => Query -> a -> m b
- mandatory_ :: (MonadDb m, FromRow a) => Query -> m a
- unique :: (MonadDb m, ToRow a, FromRow b) => Query -> a -> m (Maybe b)
- unique_ :: (MonadDb m, FromRow a) => Query -> m (Maybe a)
- query :: (MonadDb m, ToRow a, FromRow b) => Query -> a -> m [b]
- query_ :: (MonadDb m, FromRow a) => Query -> m [a]
- execute :: (MonadDb m, ToRow a) => Query -> a -> m Int64
- execute_ :: MonadDb m => Query -> m Int64
- value :: Functor f => f (Only a) -> f a
- valueWith :: Functor f => (a -> b) -> f (Only a) -> f b
- values :: (Functor f, Functor g) => g (f (Only a)) -> g (f a)
- valuesWith :: (Functor f, Functor g) => (a -> b) -> g (f (Only a)) -> g (f b)
- newtype Schema = Schema {
- renderSchema :: Text
- newSchema :: Text -> Maybe Schema
- newtype Savepoint = Savepoint {}
- newSavepoint :: Text -> Maybe Savepoint
- createSavepoint :: Savepoint -> Db ()
- releaseSavepoint :: Savepoint -> Db ()
- rollbackSavepoint :: Savepoint -> Db ()
- data Unique a
- isUnique :: Unique a -> Bool
- isDuplicate :: Unique a -> Bool
- withUniqueCheck :: MonadDb m => Db a -> m (Unique a)
- withUniqueCheckSavepoint :: MonadDb m => Savepoint -> Db a -> m (Unique a)
Documentation
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) -> {- ... -}
Instances
Functor Only | |
Eq a => Eq (Only a) | |
Ord a => Ord (Only a) | |
Read a => Read (Only a) | |
Show a => Show (Only a) | |
FromField a => FromRow (Maybe (Only a)) | |
FromField a => FromRow (Only a) | |
Defined in Database.PostgreSQL.Simple.FromRow | |
ToField a => ToRow (Only a) | |
Defined in Database.PostgreSQL.Simple.ToRow |
Wrap binary data for use as a bytea
value.
Binary | |
|
Instances
Functor Binary | |
Eq a => Eq (Binary a) | |
Ord a => Ord (Binary a) | |
Defined in Database.PostgreSQL.Simple.Types | |
Read a => Read (Binary a) | |
Show a => Show (Binary a) | |
FromField (Binary ByteString) | bytea |
Defined in Database.PostgreSQL.Simple.FromField | |
FromField (Binary ByteString) | bytea |
Defined in Database.PostgreSQL.Simple.FromField | |
ToField (Binary ByteString) | |
Defined in Database.PostgreSQL.Simple.ToField toField :: Binary ByteString -> Action # | |
ToField (Binary ByteString) | |
Defined in Database.PostgreSQL.Simple.ToField toField :: Binary ByteString -> Action # |
Instances
Eq Schema Source # | |
Data Schema Source # | |
Defined in Traction.Sql gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Schema -> c Schema # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Schema # toConstr :: Schema -> Constr # dataTypeOf :: Schema -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Schema) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Schema) # gmapT :: (forall b. Data b => b -> b) -> Schema -> Schema # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Schema -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Schema -> r # gmapQ :: (forall d. Data d => d -> u) -> Schema -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Schema -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Schema -> m Schema # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Schema -> m Schema # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Schema -> m Schema # | |
Show Schema Source # | |
ToField Schema Source # | |
Defined in Traction.Sql |
Instances
Eq Savepoint Source # | |
Data Savepoint Source # | |
Defined in Traction.Sql gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Savepoint -> c Savepoint # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Savepoint # toConstr :: Savepoint -> Constr # dataTypeOf :: Savepoint -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Savepoint) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Savepoint) # gmapT :: (forall b. Data b => b -> b) -> Savepoint -> Savepoint # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Savepoint -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Savepoint -> r # gmapQ :: (forall d. Data d => d -> u) -> Savepoint -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Savepoint -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Savepoint -> m Savepoint # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Savepoint -> m Savepoint # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Savepoint -> m Savepoint # | |
Show Savepoint Source # | |
ToField Savepoint Source # | |
Defined in Traction.Sql |
createSavepoint :: Savepoint -> Db () Source #
releaseSavepoint :: Savepoint -> Db () Source #
rollbackSavepoint :: Savepoint -> Db () Source #
isDuplicate :: Unique a -> Bool Source #