orchestrate-0.2.0.3: An API client for http://orchestrate.io/.

Safe HaskellNone
LanguageHaskell2010

Database.Orchestrate.KeyValue

Contents

Description

This implements the Key/Value API.

Generally, the data stored knows about its own key using via the OrchestrateData class instance defined for it.

Synopsis

Accessing Data

lookup :: FromJSON v => Collection -> Key -> OrchestrateIO (Maybe v) Source

This retrieves a value from a collection.

lookup "contacts" "mom"

listVals Source

Arguments

:: FromJSON v 
=> Collection

The collection to list data from.

-> Maybe Int

The maximum number of items to retrieve.

-> Range Key

The range of keys to query.

-> OrchestrateIO (KVList v)

Returns a collection of data.

This lists all the data in the collection within the range given.

listVals "coll-name" Nothing (Open, Open)

Adding and Updating Data

putV Source

Arguments

:: OrchestrateData v 
=> v

The data to store in the database.

-> IfMatch

If specified, this operation only succeeds if the ref specified matches the currently stored ref for this data.

-> OrchestrateIO Location

Returns the location of the data.

This inserts data into the database or updates existing data using a key generated by the OrchestrateData instance.

putV data NoMatch

putKV Source

Arguments

:: OrchestrateData v 
=> Key

The key to store the data under.

-> v

The data to store.

-> IfMatch

If specified, this operation only succeeds if the ref specified matches the currently stored ref for this data.

-> OrchestrateIO Location

Returns the location of the data.

This inserts data into the database or updates data in the database. This overrides the key provided by the data type's OrchestrateData instance. However, it still requires an implementation of that data type for the collection name.

putKV "key" data NoMatch

postV Source

Arguments

:: OrchestrateData v 
=> v

The data to store.

-> OrchestrateIO (Location, Maybe Key)

The Location and key for the data.

This inserts data in the database, generating a new database key for it.

postV data

Deleting Data

deleteV Source

Arguments

:: OrchestrateData v 
=> v

The data to remove.

-> IfMatch'

If given, this operation only succeeds if the ref specified matches the currently stored ref for this data.

-> OrchestrateIO () 

This removes data from the database.

deleteV data Nothing

deleteKV Source

Arguments

:: OrchestrateData v 
=> Key

The key the data is stored under.

-> v

The data to remove.

-> IfMatch'

If given, this operation only succeeds if the ref specified matches the currently stored ref for this data.

-> OrchestrateIO () 

This removes data from the database.

deleteKV "key" data Nothing

purgeV Source

Arguments

:: OrchestrateData v 
=> v

The data to remove.

-> IfMatch'

If given, this operation only succeeds if the ref specified matches the currently stored ref for this data.

-> OrchestrateIO () 

This purges data from the database. Purging not only removes the data, but also all history and secondary items for it.

purgeV data Nothing

purgeKV Source

Arguments

:: OrchestrateData v 
=> Key

The key the data is stored under.

-> v

The data to remove.

-> IfMatch'

If given, this operation only succeeds if the ref specified matches the currently stored ref for this data.

-> OrchestrateIO () 

This purges data from the database. Purging not only removes the data, but also all history and secondary items for it.

purgeKV "key" data Nothing