예제 #1
0
func ExampleClient_UpdateItem(client *dynago.Client) {
	_, err := client.UpdateItem("Person", dynago.HashKey("Id", 42)).
		UpdateExpression("SET Name=:name").
		Param(":name", "Joe").
		Execute()

	if err != nil {
		fmt.Printf("UpdateItem failed: %v", err)
	}
}
예제 #2
0
func ExampleClient_UpdateItem_atomicIncrement(client *dynago.Client, key dynago.Document) {
	result, err := client.UpdateItem("Products", key).
		UpdateExpression("SET ViewCount = ViewCount + :incr").
		Param(":incr", 5).
		ReturnValues(dynago.ReturnUpdatedNew).
		Execute()

	if err == nil {
		fmt.Printf("View count is now %d", result.Attributes["ViewCount"])
	}
}