@@ -1150,6 +1150,84 @@ Scan scanUsingSpecifiedNamespace =
11501150 .build();
11511151```
11521152
1153+ ##### Operation attributes
1154+
1155+ The operation attribute is a key-value pair that can be used to store additional information about an operation. You can set operation attributes by using the ` attribute() ` or ` attributes() ` method in the operation builder, as shown below:
1156+
1157+ ``` java
1158+ // Set operation attributes in the `Get` operation.
1159+ Get get = Get . newBuilder()
1160+ .namespace(" ns" )
1161+ .table(" tbl" )
1162+ .partitionKey(partitionKey)
1163+ .clusteringKey(clusteringKey)
1164+ .attribute(" attribute1" , " value1" )
1165+ .attributes(ImmutableMap . of(" attribute2" , " value2" , " attribute3" , " value3" ))
1166+ .build();
1167+
1168+ // Set operation attributes in the `Scan` operation.
1169+ Scan scan = Scan . newBuilder()
1170+ .namespace(" ns" )
1171+ .table(" tbl" )
1172+ .partitionKey(partitionKey)
1173+ .projections(" c1" , " c2" , " c3" , " c4" )
1174+ .attribute(" attribute1" , " value1" )
1175+ .attributes(ImmutableMap . of(" attribute2" , " value2" , " attribute3" , " value3" ))
1176+ .build();
1177+
1178+ // Set operation attributes in the `Insert` operation.
1179+ Insert insert = Insert . newBuilder()
1180+ .namespace(" ns" )
1181+ .table(" tbl" )
1182+ .partitionKey(partitionKey)
1183+ .clusteringKey(clusteringKey)
1184+ .floatValue(" c4" , 1.23F )
1185+ .doubleValue(" c5" , 4.56 )
1186+ .attribute(" attribute1" , " value1" )
1187+ .attributes(ImmutableMap . of(" attribute2" , " value2" , " attribute3" , " value3" ))
1188+ .build();
1189+
1190+ // Set operation attributes in the `Upsert` operation.
1191+ Upsert upsert = Upsert . newBuilder()
1192+ .namespace(" ns" )
1193+ .table(" tbl" )
1194+ .partitionKey(partitionKey)
1195+ .clusteringKey(clusteringKey)
1196+ .floatValue(" c4" , 1.23F )
1197+ .doubleValue(" c5" , 4.56 )
1198+ .attribute(" attribute1" , " value1" )
1199+ .attributes(ImmutableMap . of(" attribute2" , " value2" , " attribute3" , " value3" ))
1200+ .build();
1201+
1202+ // Set operation attributes in the `Update` operation.
1203+ Update update = Update . newBuilder()
1204+ .namespace(" ns" )
1205+ .table(" tbl" )
1206+ .partitionKey(partitionKey)
1207+ .clusteringKey(clusteringKey)
1208+ .floatValue(" c4" , 1.23F )
1209+ .doubleValue(" c5" , 4.56 )
1210+ .attribute(" attribute1" , " value1" )
1211+ .attributes(ImmutableMap . of(" attribute2" , " value2" , " attribute3" , " value3" ))
1212+ .build();
1213+
1214+ // Set operation attributes in the `Delete` operation.
1215+ Delete delete = Delete . newBuilder()
1216+ .namespace(" ns" )
1217+ .table(" tbl" )
1218+ .partitionKey(partitionKey)
1219+ .clusteringKey(clusteringKey)
1220+ .attribute(" attribute1" , " value1" )
1221+ .attributes(ImmutableMap . of(" attribute2" , " value2" , " attribute3" , " value3" ))
1222+ .build();
1223+ ```
1224+
1225+ :::note
1226+
1227+ ScalarDB currently has no available operation attributes.
1228+
1229+ :::
1230+
11531231#### Commit a transaction
11541232
11551233After executing CRUD operations, you need to commit a transaction to finish it.
0 commit comments