Amazon AWS SDK Guide de l'utilisateur Page 65 : Update an Item by Using Expressions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// using Amazon.DynamoDBv2.Model;
// Provides a sample item that can be added to a table.
public static Dictionary<string, AttributeValue> CreateItemData()
{
var itemData = new Dictionary<string, AttributeValue>
{
{ "Id", new AttributeValue { N = "301" } },
{ "Title", new AttributeValue { S = "18\" Girl's Bike" } },
{ "BicycleType", new AttributeValue { S = "Road" } },
{ "Brand" , new AttributeValue { S = "Brand-Company C" } },
{ "Color", new AttributeValue { SS = new List<string>{ "Blue", "Silver" }
} },
{ "Description", new AttributeValue { S = "301 description" } },
{ "Gender", new AttributeValue { S = "F" } },
{ "InStock", new AttributeValue { BOOL = true } },
{ "Pictures", new AttributeValue { L = new List<AttributeValue>{
{ new AttributeValue { M = new Dictionary<string,AttributeValue>{
{ "FrontView", new AttributeValue { S = "http://ex
ample/products/301_front.jpg" } } } } },
{ new AttributeValue { M = new Dictionary<string,AttributeValue>{
{ "RearView", new AttributeValue {S = "http://ex
ample/products/301_rear.jpg" } } } } },
{ new AttributeValue { M = new Dictionary<string,AttributeValue>{
{ "SideView", new AttributeValue { S = "http://ex
ample/products/301_left_side.jpg" } } } } }
} } },
{ "Price", new AttributeValue { N = "185" } },
{ "ProductCategory", new AttributeValue { S = "Bike" } },
{ "ProductReviews", new AttributeValue { M = new Dictionary<string,Attrib
uteValue>{
{ "FiveStar", new AttributeValue { SS = new List<string>{
"My daughter really enjoyed this bike!" } } },
{ "OneStar", new AttributeValue { SS = new List<string>{
"Fun to ride.",
"This bike was okay, but I would have preferred it in my color." } } }
} } },
{ "QuantityOnHand", new AttributeValue { N = "3" } },
{ "RelatedItems", new AttributeValue { NS = new List<string>{ "979", "822",
"801" } } }
};
return itemData;
}
In the preceding example, an example item with sample data is returned to the caller. A series of attributes
and corresponding values are constructed, using data types such as
BOOL
,
L
,
M
,
N
,
NS
,
S
, and
SS
, which
correspond to those in the
JSON Data Format
.
Update an Item by Using Expressions
The following example features the
Amazon.DynamoDBv2.AmazonDynamoDBClient.UpdateItem
method and a set of expressions to change the
Title
to
18" Girl's Bike
for the item with
Id
of
301
.
Version v2.0.0
61
AWS SDK for .NET Developer Guide
Using Expressions with DynamoDB
Fichier PDF · ·
Questions sur Amazon AWS SDK
Pas encore de questions sur ce manuel. Posez la première.
Produits connexes et manuels pour Logiciel Amazon AWS SDK
- Logiciel Amazon Redshift Manuel d'utilisateur
(24 pages) - Logiciel Amazon Redshift Manuel d'utilisateur
(11 pages) - Logiciel Amazon AWS SDK Guide de l'utilisateur
(73 pages)