Aviso:

Para brindarle información de soporte completa de manera más rápida, el contenido de esta página ha sido traducido al español mediante traducción automática. Para consultar la información de soporte más precisa, consulte la versión en inglés de este contenido.

Construir item NoSQL

Los items de Catalyst NoSQL representan una colección de atributos que contienen los datos de un único punto de datos, como registros. Puedes insertar o actualizar items en una tabla NoSQL existente de tu proyecto en un formato JSON personalizado. Sin embargo, antes de insertar o actualizar un item en Catalyst, necesitarás construir el item.

Puedes construir un item NoSQL con atributos que contengan diferentes tipos de datos soportados por Catalyst como se describe en la sección a continuación. Catalyst soporta varios tipos de datos como String, Number, Set of Strings, Set of Numbers, List y Map. Consulta la lista completa de tipos de datos soportados en el recurso compartido para obtener más información.

Debes proporcionar obligatoriamente los valores del atributo de clave de partición que configuraste para una tabla en cada item de datos. Consulta la sección de ayuda de claves de tabla para conocer las claves de tabla, el atributo TTL y otros detalles.


Crear un nuevo item NoSQL

Puedes crear un nuevo item NoSQL usando el método ZCNoSQLItem(), como se muestra a continuación.

copy
ZCNoSQLItem item = new ZCNoSQLItem();

Crear un nuevo item NoSQL con JSON / Map

Puedes crear un nuevo item NoSQL a partir de datos JSON planos o de un Map después de definirlos como se muestra a continuación.

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

Construir items NoSQL de diferentes tipos de datos

El fragmento de código a continuación muestra los formatos para construir un item con atributos de diferentes tipos de datos:

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>");

Última actualización 2026-03-20 21:51:56 +0530 IST