| License | BSD-3-Clause |
|---|---|
| Safe Haskell | None |
| Language | GHC2024 |
Stack.Storage.Util
Description
Utilities for the other Stack.Storage modules.
Synopsis
- handleMigrationException :: HasLogFunc env => RIO env a -> RIO env a
- updateCollection :: forall record backend collection rawValue value (m :: Type -> Type). (PersistEntityBackend record ~ BaseBackend backend, Eq (collection rawValue), PersistEntity record, PersistField value, MonadIO m, PersistQueryWrite backend, SafeToInsert record, Foldable collection) => (collection rawValue -> collection rawValue -> ([Filter record], [value])) -> (value -> record) -> [Filter record] -> collection rawValue -> collection rawValue -> ReaderT backend m ()
- setUpdateDiff :: (Ord value, PersistField value) => EntityField record value -> Set value -> Set value -> ([Filter record], [value])
- listUpdateDiff :: Ord value => EntityField record Int -> [value] -> [value] -> ([Filter record], [(Int, value)])
Documentation
handleMigrationException :: HasLogFunc env => RIO env a -> RIO env a Source #
Arguments
| :: forall record backend collection rawValue value (m :: Type -> Type). (PersistEntityBackend record ~ BaseBackend backend, Eq (collection rawValue), PersistEntity record, PersistField value, MonadIO m, PersistQueryWrite backend, SafeToInsert record, Foldable collection) | |
| => (collection rawValue -> collection rawValue -> ([Filter record], [value])) | Function to yield items in old not in new, to delete, and values in new not in old, to add, from the old and new collections of values. |
| -> (value -> record) | Function to yield new records from values in new not in old. |
| -> [Filter record] | Extra items to delete, if there are other items to delete. |
| -> collection rawValue | The old collection of values. |
| -> collection rawValue | The new collection of values. |
| -> ReaderT backend m () |
Efficiently update a collection of values with a given diff function.
setUpdateDiff :: (Ord value, PersistField value) => EntityField record value -> Set value -> Set value -> ([Filter record], [value]) Source #
listUpdateDiff :: Ord value => EntityField record Int -> [value] -> [value] -> ([Filter record], [(Int, value)]) Source #