| Copyright | (c) 2018-2022 Tim Emiola |
|---|---|
| License | BSD3 |
| Maintainer | Tim Emiola <tim@emio.la> |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
KeyedVals.Handle
Description
Declares the abstract and combinators used to load and save keyed values.Handle
Synopsis
- data Handle m
- data HandleErr
- = ConnectionClosed
- | Unanticipated !Text
- | NotDecoded !Text
- | BadKey
- | Gone !Key
- countKVs :: Handle m -> Key -> m (Either HandleErr Natural)
- loadVal :: Handle m -> Key -> m (Either HandleErr (Maybe Val))
- saveVal :: Handle m -> Key -> Val -> m (Either HandleErr ())
- loadKVs :: Handle m -> Key -> m (Either HandleErr ValsByKey)
- saveKVs :: Handle m -> Key -> ValsByKey -> m (Either HandleErr ())
- updateKVs :: Handle m -> Key -> ValsByKey -> m (Either HandleErr ())
- loadSlice :: Handle m -> Key -> Selection -> m (Either HandleErr ValsByKey)
- loadFrom :: Handle m -> Key -> Key -> m (Either HandleErr (Maybe Val))
- saveTo :: Handle m -> Key -> Key -> Val -> m (Either HandleErr ())
- deleteKeys :: Handle m -> NonEmpty Key -> m (Either HandleErr ())
- deleteKeysFrom :: Handle m -> Key -> NonEmpty Key -> m (Either HandleErr ())
- deleteMatches :: Handle m -> Glob -> m (Either HandleErr ())
- deleteMatchesFrom :: Handle m -> Key -> Glob -> m (Either HandleErr ())
- deleteSelected :: Handle m -> Selection -> m (Either HandleErr ())
- deleteSelectedFrom :: Handle m -> Key -> Selection -> m (Either HandleErr ())
- data Selection
- data Glob
- mkGlob :: ByteString -> Maybe Glob
- isIn :: ByteString -> Selection -> Bool
- type Key = ByteString
- type Val = ByteString
- type ValsByKey = Map Key Val
Handle and related types and functions
Represents the errors that might arise in Handle functions
Constructors
| ConnectionClosed | |
| Unanticipated !Text | |
| NotDecoded !Text | |
| BadKey | |
| Gone !Key |
Instances
| Exception HandleErr Source # | |
Defined in KeyedVals.Handle.Internal Methods toException :: HandleErr -> SomeException # fromException :: SomeException -> Maybe HandleErr # displayException :: HandleErr -> String # | |
| Show HandleErr Source # | |
| Eq HandleErr Source # | |
countKVs :: Handle m -> Key -> m (Either HandleErr Natural) Source #
Determines the number of in a Vals.ValsByKey
deleteMatches :: Handle m -> Glob -> m (Either HandleErr ()) Source #
Deletes whose ValsKeys match a Glob.
Selection and Glob
Represents ways of restricting the keys used in a ValsByKey
Constructors
| Match !Glob | any keys that match the glob pattern |
| AllOf !(NonEmpty Key) | any of the specified keys |
Represents a redis glob use to select keys
isIn :: ByteString -> Selection -> Bool Source #
tests if a ByteString matches a Selection
aliases used by the Handle functions
type Key = ByteString Source #
Represents a key used to store a Value.
type Val = ByteString Source #
Represents a value stored in the service.