dynamodb-simple-0.5.0.0: Typesafe library for working with DynamoDB database

Safe HaskellNone
LanguageHaskell2010

Database.DynamoDB.Update

Contents

Description

Module for creating update actions

Example as used in nested structure for scan:

updateItemByKey_ (Proxy :: Proxy Test, ("hashkey", "sortkey"))
                 ((iInt' +=. 5) <> (iText' =. "updated") <> (iMText' =. Nothing))

The unique Action can be added together using the <> operator. You are not supposed to operate on the same attribute simultaneously using multiple actions.

Synopsis

Documentation

data Action t Source #

An action for updateItemByKey functions.

Instances

Semigroup (Action t) Source # 

Methods

(<>) :: Action t -> Action t -> Action t #

sconcat :: NonEmpty (Action t) -> Action t #

stimes :: Integral b => b -> Action t -> Action t #

Monoid (Action t) Source # 

Methods

mempty :: Action t #

mappend :: Action t -> Action t -> Action t #

mconcat :: [Action t] -> Action t #

Update action

(+=.) :: (InCollection col tbl FullPath, DynamoScalar v typ, IsNumber typ) => Column typ TypColumn col -> typ -> Action tbl infix 4 Source #

Add a number to a saved attribute.

(-=.) :: (InCollection col tbl FullPath, DynamoScalar v typ, IsNumber typ) => Column typ TypColumn col -> typ -> Action tbl infix 4 Source #

Subtract a number from a saved attribute.

(=.) :: (InCollection col tbl FullPath, DynamoEncodable typ) => Column typ TypColumn col -> typ -> Action tbl infix 4 Source #

Set an attribute to a new value.

setIfNothing :: (InCollection col tbl FullPath, DynamoEncodable typ) => Column (Maybe typ) TypColumn col -> typ -> Action tbl Source #

Set on a Maybe type, if it was not set before.

append :: (InCollection col tbl FullPath, DynamoEncodable typ) => Column [typ] TypColumn col -> [typ] -> Action tbl Source #

Append a new value to an end of a list.

prepend :: (InCollection col tbl FullPath, DynamoEncodable typ) => Column [typ] TypColumn col -> [typ] -> Action tbl Source #

Insert a value to a beginning of a list

add :: (InCollection col tbl FullPath, DynamoEncodable (Set typ)) => Column (Set typ) TypColumn col -> Set typ -> Action tbl Source #

Add a new value to a set.

delete :: (InCollection col tbl FullPath, DynamoEncodable (Set typ)) => Column (Set typ) TypColumn col -> Set typ -> Action tbl Source #

Remove a value from a set.

delListItem :: InCollection col tbl FullPath => Column [typ] TypColumn col -> Int -> Action tbl Source #

Delete n-th list of an item.

delHashKey :: (InCollection col tbl FullPath, IsText key) => Column (HashMap key typ) TypColumn col -> key -> Action tbl Source #

Delete a key from a map.

Utility function

dumpActions :: Action t -> Maybe (Text, HashMap Text Text, HashMap Text AttributeValue) Source #

Generate an action expression and associated structures from a list of actions