Copyright | (c) 2011 MailRank, Inc. |
---|---|
License | Apache |
Maintainer | Mark Hibberd <mark@hibberd.id.au>, Nathan Hunter <nhunter@janrain.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell98 |
This module allows storage and retrieval of JSON-encoded data.
The functions in this module do not perform any conflict resolution.
- data JSON a
- json :: (FromJSON a, ToJSON a) => a -> JSON a
- plain :: JSON a -> a
- get :: (FromJSON c, ToJSON c) => Connection -> Bucket -> Key -> R -> IO (Maybe ([c], VClock))
- getMany :: (FromJSON c, ToJSON c) => Connection -> Bucket -> [Key] -> R -> IO [Maybe ([c], VClock)]
- put :: (FromJSON c, ToJSON c) => Connection -> Bucket -> Key -> Maybe VClock -> c -> W -> DW -> IO ([c], VClock)
- putIndexed :: (FromJSON c, ToJSON c) => Connection -> Bucket -> Key -> [IndexValue] -> Maybe VClock -> c -> W -> DW -> IO ([c], VClock)
- put_ :: (FromJSON c, ToJSON c) => Connection -> Bucket -> Key -> Maybe VClock -> c -> W -> DW -> IO ()
- putMany :: (FromJSON c, ToJSON c) => Connection -> Bucket -> [(Key, Maybe VClock, c)] -> W -> DW -> IO [([c], VClock)]
- putMany_ :: (FromJSON c, ToJSON c) => Connection -> Bucket -> [(Key, Maybe VClock, c)] -> W -> DW -> IO ()
Documentation
json :: (FromJSON a, ToJSON a) => a -> JSON a Source
Wrap up a value so that it will be encoded and decoded as JSON
when converted to/from Content
.
get :: (FromJSON c, ToJSON c) => Connection -> Bucket -> Key -> R -> IO (Maybe ([c], VClock)) Source
Retrieve a value. This may return multiple conflicting siblings. Choosing among them is your responsibility.
getMany :: (FromJSON c, ToJSON c) => Connection -> Bucket -> [Key] -> R -> IO [Maybe ([c], VClock)] Source
put :: (FromJSON c, ToJSON c) => Connection -> Bucket -> Key -> Maybe VClock -> c -> W -> DW -> IO ([c], VClock) Source
Store a single value. This may return multiple conflicting siblings. Choosing among them, and storing a new value, is your responsibility.
You should only supply Nothing
as a VClock
if you are sure
that the given bucket+key combination does not already exist. If
you omit a VClock
but the bucket+key does exist, your value
will not be stored.
putIndexed :: (FromJSON c, ToJSON c) => Connection -> Bucket -> Key -> [IndexValue] -> Maybe VClock -> c -> W -> DW -> IO ([c], VClock) Source
Store a single value indexed.
put_ :: (FromJSON c, ToJSON c) => Connection -> Bucket -> Key -> Maybe VClock -> c -> W -> DW -> IO () Source
Store a single value, without the possibility of conflict resolution.
You should only supply Nothing
as a VClock
if you are sure
that the given bucket+key combination does not already exist. If
you omit a VClock
but the bucket+key does exist, your value
will not be stored, and you will not be notified.
putMany :: (FromJSON c, ToJSON c) => Connection -> Bucket -> [(Key, Maybe VClock, c)] -> W -> DW -> IO [([c], VClock)] Source
Store many values. This may return multiple conflicting siblings for each value stored. Choosing among them, and storing a new value in each case, is your responsibility.
You should only supply Nothing
as a VClock
if you are sure
that the given bucket+key combination does not already exist. If
you omit a VClock
but the bucket+key does exist, your value
will not be stored.