お知らせ:

当社は、お客様により充実したサポート情報を迅速に提供するため、本ページのコンテンツは機械翻訳を用いて日本語に翻訳しています。正確かつ最新のサポート情報をご覧いただくには、本内容の英語版を参照してください。

NoSQLアイテムの構築

Catalyst NoSQLのアイテムは、レコードのような単一のデータポイントのデータを保持する属性のコレクションを表します。プロジェクト内の既存のNoSQLテーブルにカスタムJSON形式アイテムを挿入または更新できます。ただし、Catalystでアイテムを挿入または更新する前に、アイテムを構築する必要があります。

以下のセクションで説明するように、Catalystがサポートする異なるデータ型の属性を含むNoSQLアイテムを構築できます。CatalystはString、Number、Set of Strings、Set of Numbers、List、Mapなど、いくつかのデータ型をサポートしています。詳細については、共有リソースのサポートされるデータ型の完全なリストを参照してください。

テーブルに対して構成したパーティションキー属性の値を、すべてのデータアイテムで必ず提供する必要があります。テーブルキー、TTL属性、およびその他の詳細については、テーブルキーのヘルプセクションを参照してください。


新しいNoSQLアイテムの作成

以下に示すように、ZCNoSQLItem()メソッドを使用して新しいNoSQLアイテムを作成できます。

copy
ZCNoSQLItem item = new ZCNoSQLItem();

JSONまたはMapからの新しいNoSQLアイテムの作成

以下に示すように、プレーンJSONデータまたはMapを定義した後、そこから新しいNoSQLアイテムを作成できます。

copy
//public static ZCNoSQLItem fromJSON(String json) throws Exception;
ZCNoSQLItem.fromJSON(<json string>);

異なるデータ型のNoSQLアイテムの構築

以下のコードスニペットは、異なるデータ型の属性を持つアイテムを構築する形式を示しています:

copy
//public ZCNoSQLItem withString(String attrName, String val) throws Exception;
item.withString("attribute name", "<string value>");
//public ZCNoSQLItem withNumber(String attrName, BigDecimal val) throws Exception;
//public ZCNoSQLItem withNumber(String attrName, Number val) throws Exception;
item.withNumber("attribute name", "<numeric value>");
//public ZCNoSQLItem withInt(String attrName, int val) throws Exception;
item.withInt("attribute name", "<integer value>");
//public ZCNoSQLItem withBigInteger(String attrName, BigInteger val) throws Exception;
item.withBigInteger("attribute name", "<BigInt value>");
//public ZCNoSQLItem withShort(String attrName, short val) throws Exception;
item.withShort("attribute name", "<Short value>");
//public ZCNoSQLItem withFloat(String attrName, float val) throws Exception;
item.withFloat("attribute name", "<Float value>");
//public ZCNoSQLItem withDouble(String attrName, double val) throws Exception;
item.withDouble("attribute name", "<Double value>");
//public ZCNoSQLItem withLong(String attrName, long val) throws Exception;
item.withLong("attribute name", "<Long value>");
//public ZCNoSQLItem withBinary(String attrName, byte[] val) throws Exception;
//public ZCNoSQLItem withBinary(String attrName, ByteBuffer val) throws Exception;
item.withBinary("attribute name", "<Byte value>");
//public ZCNoSQLItem withStringSet(String attrName, Set<String> val) throws Exception;
//public ZCNoSQLItem withStringSet(String attrName, String... val) throws Exception;
item.withStringSet("attribute name", "<StringSet/String variadic param value>");
//public ZCNoSQLItem withBigDecimalSet(String attrName, Set<BigDecimal> val) throws Exception;
//public ZCNoSQLItem withBigDecimalSet(String attrName, BigDecimal... vals) throws Exception;
item.withBigDecimalSet("attribute name", "<DecimalSet/Decimal Variadic param value>");
//public <T extends Number> ZCNoSQLItem withNumberSet(String attrName, T... vals) throws Exception;
//public <T extends Number> ZCNoSQLItem withNumberSet(String attrName, Set<T> vals) throws Exception;
item.withNumberSet("attribute name", "<Numeric/Numeric Variadic param value>");
//public ZCNoSQLItem withBinarySet(String attrName, Set<byte[]> val) throws Exception;
//public ZCNoSQLItem withBinarySet(String attrName, byte[]... vals) throws Exception;
//public ZCNoSQLItem withBinarySet(String attrName, ByteBuffer... vals) throws Exception;
item.withBinarySet("attribute name", "<Byte Set value>");
//public ZCNoSQLItem withByteBufferSet(String attrName, Set<ByteBuffer> val) throws Exception;
item.withByteBufferSet("attribute name", "<Byte Set value>");
//public ZCNoSQLItem withList(String attrName, List<?> val) throws Exception;
//public ZCNoSQLItem withList(String attrName, Object... vals) throws Exception;
item.withList("attribute name", "<List/Variadic Param value>");
//public ZCNoSQLItem withMap(String attrName, Map<String, ?> val) throws Exception;
item.withMap("attribute name", "<Map value>");
//public ZCNoSQLItem withJSON(String attrName, String json) throws Exception;
item.withJSON("attribute name", "<JSON String value>");
//public ZCNoSQLItem withBoolean(String attrName, boolean val) throws Exception;
item.withBoolean("attribute name", "<Boolean value>");
//public ZCNoSQLItem withNull(String attrName) throws Exception;
item.withNull("attribute name");
//public ZCNoSQLItem with(String attrName, Object val) throws Exception;
item.with("attribute name", "<Value>");

最終更新日 2026-02-23 18:09:41 +0530 IST