Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Mensam.Server.Database.Extra
Synopsis
- queryUnique :: (MonadSelda m, MonadThrow m, Result a) => Query (Backend m) a -> m (Maybe (Res a))
- data SqlErrorMensamNotUniqueQuery = MkSqlErrorMensamNotUniqueQuery
- queryOne :: (MonadSelda m, MonadCatch m, Result a) => Query (Backend m) a -> m (Res a)
- newtype SqlErrorMensamNotOneQuery = MkSqlErrorMensamNotOneQuery (Maybe SqlErrorMensamNotUniqueQuery)
- insertOne :: (MonadSelda m, MonadThrow m, Relational a) => Table a -> a -> m ()
- deleteUniqueFrom :: (MonadSelda m, MonadThrow m, Relational a) => Table a -> (Row (Backend m) a -> Col (Backend m) Bool) -> m Bool
- deleteOneFrom :: (MonadSelda m, MonadThrow m, Relational a) => Table a -> (Row (Backend m) a -> Col (Backend m) Bool) -> m ()
- updateUnique :: (MonadSelda m, MonadThrow m, Relational a) => Table a -> (Row (Backend m) a -> Col (Backend m) Bool) -> (Row (Backend m) a -> Row (Backend m) a) -> m ()
- data SqlErrorMensamNotUniqueUpdate = MkSqlErrorMensamNotUniqueUpdate
- updateOne :: (MonadSelda m, MonadThrow m, Relational a) => Table a -> (Row (Backend m) a -> Col (Backend m) Bool) -> (Row (Backend m) a -> Row (Backend m) a) -> m ()
- newtype SqlErrorMensamNotOneUpdate = MkSqlErrorMensamNotOneUpdate (Maybe SqlErrorMensamNotUniqueUpdate)
- data SomeCol t = forall a.SqlType a => MkSomeCol (Col t a)
- orderFlexible :: Same s t => (c -> SomeCol s) -> OrderByCategories c -> Query t ()
- newtype SqlEnumStripPrefix prefix a = MkSqlEnumStripPrefix {
- unSqlEnumStripPrefix :: a
Documentation
queryUnique :: (MonadSelda m, MonadThrow m, Result a) => Query (Backend m) a -> m (Maybe (Res a)) Source #
Run query
, but throw an error when there are multiple results.
data SqlErrorMensamNotUniqueQuery Source #
Expected unique result, but the query returned multiple results.
Constructors
MkSqlErrorMensamNotUniqueQuery |
Instances
queryOne :: (MonadSelda m, MonadCatch m, Result a) => Query (Backend m) a -> m (Res a) Source #
Run query
, but throw an error unless there is exactly one result.
newtype SqlErrorMensamNotOneQuery Source #
Expected exactly one result, but the query didn't return a lone result.
Constructors
MkSqlErrorMensamNotOneQuery (Maybe SqlErrorMensamNotUniqueQuery) |
Instances
insertOne :: (MonadSelda m, MonadThrow m, Relational a) => Table a -> a -> m () Source #
Run insert
, but throw an error unless exactly one row is being inserted.
deleteUniqueFrom :: (MonadSelda m, MonadThrow m, Relational a) => Table a -> (Row (Backend m) a -> Col (Backend m) Bool) -> m Bool Source #
Run deleteFrom
, but throw an error when multiple rows have been deleted.
deleteOneFrom :: (MonadSelda m, MonadThrow m, Relational a) => Table a -> (Row (Backend m) a -> Col (Backend m) Bool) -> m () Source #
Run deleteFrom
, but throw an error unless exactly one row has been deleted.
updateUnique :: (MonadSelda m, MonadThrow m, Relational a) => Table a -> (Row (Backend m) a -> Col (Backend m) Bool) -> (Row (Backend m) a -> Row (Backend m) a) -> m () Source #
Run update
, but throw an error when multiple rows are affected.
data SqlErrorMensamNotUniqueUpdate Source #
Expected to update a single row, but the update matched multiple rows.
Constructors
MkSqlErrorMensamNotUniqueUpdate |
Instances
updateOne :: (MonadSelda m, MonadThrow m, Relational a) => Table a -> (Row (Backend m) a -> Col (Backend m) Bool) -> (Row (Backend m) a -> Row (Backend m) a) -> m () Source #
Run update
, but throw an error unless exactly one row is affected.
newtype SqlErrorMensamNotOneUpdate Source #
Expected to update exactly one row, but the update did not match exactly one row.
Constructors
MkSqlErrorMensamNotOneUpdate (Maybe SqlErrorMensamNotUniqueUpdate) |
Instances
orderFlexible :: Same s t => (c -> SomeCol s) -> OrderByCategories c -> Query t () Source #
newtype SqlEnumStripPrefix prefix a Source #
Constructors
MkSqlEnumStripPrefix | |
Fields
|