Safe Haskell | None |
---|---|
Language | Haskell98 |
Database interpreter based on a JSON file
- data CacheStatus
- data JsonFileDatabase t = JsonFileDatabase FilePath (Map (Key t) (Entry t)) CacheStatus
- mkJsonFileDatabase :: Table t => FilePath -> JsonFileDatabase t
- defaultDatabase :: Table t => IO (JsonFileDatabase t)
- data JsonException = UnableDecode
- mkCoDatabase :: (Table t, FromJSON (Key t), FromJSON (Entry t), ToJSON (Key t), ToJSON (Entry t), MonadIO m, MonadCatch m) => JsonFileDatabase t -> CoDatabaseF t m (JsonFileDatabase t)
- loadInCache :: (Table t, MonadIO m, MonadCatch m, FromJSON (Key t), FromJSON (Entry t)) => JsonFileDatabase t -> m (JsonFileDatabase t)
- insert :: (Table t, MonadIO m, MonadCatch m, FromJSON (Key t), FromJSON (Entry t)) => JsonFileDatabase t -> [(Key t, Entry t)] -> m (JsonFileDatabase t)
- insertInCache :: Table t => [(Key t, Entry t)] -> JsonFileDatabase t -> JsonFileDatabase t
- update :: (Table t, MonadIO m, MonadCatch m, FromJSON (Key t), FromJSON (Entry t)) => JsonFileDatabase t -> Key t -> (Entry t -> Entry t) -> m (JsonFileDatabase t)
- updateInCache :: Table t => Key t -> (Entry t -> Entry t) -> JsonFileDatabase t -> JsonFileDatabase t
- delete :: (Table t, MonadIO m, MonadCatch m, FromJSON (Key t), FromJSON (Entry t)) => JsonFileDatabase t -> [Key t] -> m (JsonFileDatabase t)
- deleteInCache :: Table t => [Key t] -> JsonFileDatabase t -> JsonFileDatabase t
- purge :: (Table t, MonadIO m, MonadCatch m, FromJSON (Key t), FromJSON (Entry t)) => JsonFileDatabase t -> m (JsonFileDatabase t)
- purgeInCache :: Table t => JsonFileDatabase t -> JsonFileDatabase t
- commit :: (MonadIO m, ToJSON (Key t), ToJSON (Entry t)) => JsonFileDatabase t -> m (JsonFileDatabase t)
Types
data JsonFileDatabase t Source #
JsonFileDatabase FilePath (Map (Key t) (Entry t)) CacheStatus |
mkJsonFileDatabase :: Table t => FilePath -> JsonFileDatabase t Source #
defaultDatabase :: Table t => IO (JsonFileDatabase t) Source #
Default database is stored in $XDG_CONFIG_HOME/imm/feeds.json
data JsonException Source #
Interpreter
mkCoDatabase :: (Table t, FromJSON (Key t), FromJSON (Entry t), ToJSON (Key t), ToJSON (Entry t), MonadIO m, MonadCatch m) => JsonFileDatabase t -> CoDatabaseF t m (JsonFileDatabase t) Source #
Interpreter for DatabaseF
Low-level implementation
loadInCache :: (Table t, MonadIO m, MonadCatch m, FromJSON (Key t), FromJSON (Entry t)) => JsonFileDatabase t -> m (JsonFileDatabase t) Source #
insert :: (Table t, MonadIO m, MonadCatch m, FromJSON (Key t), FromJSON (Entry t)) => JsonFileDatabase t -> [(Key t, Entry t)] -> m (JsonFileDatabase t) Source #
insertInCache :: Table t => [(Key t, Entry t)] -> JsonFileDatabase t -> JsonFileDatabase t Source #
update :: (Table t, MonadIO m, MonadCatch m, FromJSON (Key t), FromJSON (Entry t)) => JsonFileDatabase t -> Key t -> (Entry t -> Entry t) -> m (JsonFileDatabase t) Source #
updateInCache :: Table t => Key t -> (Entry t -> Entry t) -> JsonFileDatabase t -> JsonFileDatabase t Source #
delete :: (Table t, MonadIO m, MonadCatch m, FromJSON (Key t), FromJSON (Entry t)) => JsonFileDatabase t -> [Key t] -> m (JsonFileDatabase t) Source #
deleteInCache :: Table t => [Key t] -> JsonFileDatabase t -> JsonFileDatabase t Source #
purge :: (Table t, MonadIO m, MonadCatch m, FromJSON (Key t), FromJSON (Entry t)) => JsonFileDatabase t -> m (JsonFileDatabase t) Source #
purgeInCache :: Table t => JsonFileDatabase t -> JsonFileDatabase t Source #
commit :: (MonadIO m, ToJSON (Key t), ToJSON (Entry t)) => JsonFileDatabase t -> m (JsonFileDatabase t) Source #