owenbot-0.1.0.0
Safe HaskellNone
LanguageHaskell2010

DB

Synopsis

Documentation

dbDir :: IO FilePath Source #

Directory to store KeyValues in: ~.localshareowendb on UNIX, %APPDATA% on Windows. Controlled by XDG_DATA environment variable.

readKV :: FilePath -> IO KeyValue Source #

Reads a KeyValue DB from a file

lookupKV :: Text -> KeyValue -> Maybe Text Source #

Returns `Just T.Text` if k is in the KeyValue, Nothing otherwise.

prependKV :: Text -> Text -> KeyValue -> KeyValue Source #

O(n) - Adds (k,v) to the start of the KeyValue

writeKV :: FilePath -> KeyValue -> IO () Source #

Writes a KeyValue to a file TODO: Handle errors

fetch :: FilePath -> Text -> IO Text Source #

Gets a value from a given db; if it doesn't exist, return ""

store :: FilePath -> Text -> Text -> IO () Source #

Prepends a key value pair to a db file. Handles it all! TODO: This should really signal failure to the caller