# CassValue

### struct CassValue

A single primitive value or a collection of values. 

### Public Functions

### [CassIterator](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/struct.CassIterator.md#_CPPv412CassIterator) \*cass_iterator_from_collection(const [CassValue](#_CPPv49CassValue) \*value)

Creates a new iterator for the specified collection. This can be used to iterate over values in a collection.

#### SEE ALSO
cass_iterator_free() 

* **Parameters:**
  **value** – **[in]** 
* **Returns:**
  A new iterator that must be freed. NULL returned if the value is not a collection.

### [CassIterator](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/struct.CassIterator.md#_CPPv412CassIterator) \*cass_iterator_from_map(const [CassValue](#_CPPv49CassValue) \*value)

Creates a new iterator for the specified map. This can be used to iterate over key/value pairs in a map.

#### SEE ALSO
cass_iterator_free() 

* **Parameters:**
  **value** – **[in]** 
* **Returns:**
  A new iterator that must be freed. NULL returned if the value is not a map.

### [CassIterator](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/struct.CassIterator.md#_CPPv412CassIterator) \*cass_iterator_from_tuple(const [CassValue](#_CPPv49CassValue) \*value)

Creates a new iterator for the specified tuple. This can be used to iterate over values in a tuple.

#### SEE ALSO
cass_iterator_free() 

* **Parameters:**
  **value** – **[in]** 
* **Returns:**
  A new iterator that must be freed. NULL returned if the value is not a tuple.

### [CassIterator](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/struct.CassIterator.md#_CPPv412CassIterator) \*cass_iterator_fields_from_user_type(const [CassValue](#_CPPv49CassValue) \*value)

Creates a new iterator for the specified user defined type. This can be used to iterate over fields in a user defined type.

#### SEE ALSO
cass_iterator_free() 

* **Parameters:**
  **value** – **[in]** 
* **Returns:**
  A new iterator that must be freed. NULL returned if the value is not a user defined type.

### const [CassDataType](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/struct.CassDataType.md#_CPPv412CassDataType) \*cass_value_data_type(const [CassValue](#_CPPv49CassValue) \*value)

Gets the data type of a value.

* **Parameters:**
  **value** – **[in]** 
* **Returns:**
  Returns a reference to the data type of the value. Do not free this reference as it is bound to the lifetime of the value. 

### [CassError](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.CassError.md#_CPPv49CassError) cass_value_get_int8(const [CassValue](#_CPPv49CassValue) \*value, [cass_int8_t](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.BasicTypes.md#_CPPv411cass_int8_t) \*output)

Gets an int8 for the specified value.

* **Parameters:**
  * **value** – **[in]** 
  * **output** – **[out]** 
* **Returns:**
  CASS_OK if successful, otherwise error occurred 

### [CassError](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.CassError.md#_CPPv49CassError) cass_value_get_int16(const [CassValue](#_CPPv49CassValue) \*value, [cass_int16_t](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.BasicTypes.md#_CPPv412cass_int16_t) \*output)

Gets an int16 for the specified value.

* **Parameters:**
  * **value** – **[in]** 
  * **output** – **[out]** 
* **Returns:**
  CASS_OK if successful, otherwise error occurred 

### [CassError](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.CassError.md#_CPPv49CassError) cass_value_get_int32(const [CassValue](#_CPPv49CassValue) \*value, [cass_int32_t](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.BasicTypes.md#_CPPv412cass_int32_t) \*output)

Gets an int32 for the specified value.

* **Parameters:**
  * **value** – **[in]** 
  * **output** – **[out]** 
* **Returns:**
  CASS_OK if successful, otherwise error occurred 

### [CassError](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.CassError.md#_CPPv49CassError) cass_value_get_uint32(const [CassValue](#_CPPv49CassValue) \*value, [cass_uint32_t](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.BasicTypes.md#_CPPv413cass_uint32_t) \*output)

Gets an uint32 for the specified value.

* **Parameters:**
  * **value** – **[in]** 
  * **output** – **[out]** 
* **Returns:**
  CASS_OK if successful, otherwise error occurred 

### [CassError](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.CassError.md#_CPPv49CassError) cass_value_get_int64(const [CassValue](#_CPPv49CassValue) \*value, [cass_int64_t](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.BasicTypes.md#_CPPv412cass_int64_t) \*output)

Gets an int64 for the specified value.

* **Parameters:**
  * **value** – **[in]** 
  * **output** – **[out]** 
* **Returns:**
  CASS_OK if successful, otherwise error occurred 

### [CassError](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.CassError.md#_CPPv49CassError) cass_value_get_float(const [CassValue](#_CPPv49CassValue) \*value, [cass_float_t](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.BasicTypes.md#_CPPv412cass_float_t) \*output)

Gets a float for the specified value.

* **Parameters:**
  * **value** – **[in]** 
  * **output** – **[out]** 
* **Returns:**
  CASS_OK if successful, otherwise error occurred 

### [CassError](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.CassError.md#_CPPv49CassError) cass_value_get_double(const [CassValue](#_CPPv49CassValue) \*value, [cass_double_t](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.BasicTypes.md#_CPPv413cass_double_t) \*output)

Gets a double for the specified value.

* **Parameters:**
  * **value** – **[in]** 
  * **output** – **[out]** 
* **Returns:**
  CASS_OK if successful, otherwise error occurred 

### [CassError](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.CassError.md#_CPPv49CassError) cass_value_get_bool(const [CassValue](#_CPPv49CassValue) \*value, [cass_bool_t](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.BasicTypes.md#_CPPv411cass_bool_t) \*output)

Gets a bool for the specified value.

* **Parameters:**
  * **value** – **[in]** 
  * **output** – **[out]** 
* **Returns:**
  CASS_OK if successful, otherwise error occurred 

### [CassError](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.CassError.md#_CPPv49CassError) cass_value_get_uuid(const [CassValue](#_CPPv49CassValue) \*value, [CassUuid](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/struct.CassUuid.md#_CPPv48CassUuid) \*output)

Gets a UUID for the specified value.

* **Parameters:**
  * **value** – **[in]** 
  * **output** – **[out]** 
* **Returns:**
  CASS_OK if successful, otherwise error occurred 

### [CassError](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.CassError.md#_CPPv49CassError) cass_value_get_inet(const [CassValue](#_CPPv49CassValue) \*value, [CassInet](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/struct.CassInet.md#_CPPv48CassInet) \*output)

Gets an INET for the specified value.

* **Parameters:**
  * **value** – **[in]** 
  * **output** – **[out]** 
* **Returns:**
  CASS_OK if successful, otherwise error occurred 

### [CassError](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.CassError.md#_CPPv49CassError) cass_value_get_string(const [CassValue](#_CPPv49CassValue) \*value, const char \*\*output, size_t \*output_size)

Gets a string for the specified value.

* **Parameters:**
  * **value** – **[in]** 
  * **output** – **[out]** 
  * **output_size** – **[out]** 
* **Returns:**
  CASS_OK if successful, otherwise error occurred 

### [CassError](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.CassError.md#_CPPv49CassError) cass_value_get_bytes(const [CassValue](#_CPPv49CassValue) \*value, const [cass_byte_t](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.BasicTypes.md#_CPPv411cass_byte_t) \*\*output, size_t \*output_size)

Gets the bytes of the specified value.

* **Parameters:**
  * **value** – **[in]** 
  * **output** – **[out]** 
  * **output_size** – **[out]** 
* **Returns:**
  CASS_OK if successful, otherwise error occurred 

### [CassError](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.CassError.md#_CPPv49CassError) cass_value_get_decimal(const [CassValue](#_CPPv49CassValue) \*value, const [cass_byte_t](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.BasicTypes.md#_CPPv411cass_byte_t) \*\*varint, size_t \*varint_size, [cass_int32_t](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.BasicTypes.md#_CPPv412cass_int32_t) \*scale)

Gets a decimal for the specified value.

* **Parameters:**
  * **value** – **[in]** 
  * **varint** – **[out]** 
  * **varint_size** – **[out]** 
  * **scale** – **[out]** 
* **Returns:**
  CASS_OK if successful, otherwise error occurred 

### [CassError](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.CassError.md#_CPPv49CassError) cass_value_get_duration(const [CassValue](#_CPPv49CassValue) \*value, [cass_int32_t](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.BasicTypes.md#_CPPv412cass_int32_t) \*months, [cass_int32_t](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.BasicTypes.md#_CPPv412cass_int32_t) \*days, [cass_int64_t](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.BasicTypes.md#_CPPv412cass_int64_t) \*nanos)

Gets a duration for the specified value.

**Requires Apache Cassandra:** 3.10+

* **Parameters:**
  * **value** – **[in]** 
  * **months** – **[out]** 
  * **days** – **[out]** 
  * **nanos** – **[out]** 
* **Returns:**
  CASS_OK if successful, otherwise error occurred 

### [CassValueType](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.CassValueType.md#_CPPv413CassValueType) cass_value_type(const [CassValue](#_CPPv49CassValue) \*value)

Gets the type of the specified value.

* **Parameters:**
  **value** – **[in]** 
* **Returns:**
  The type of the specified value. 

### [cass_bool_t](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.BasicTypes.md#_CPPv411cass_bool_t) cass_value_is_null(const [CassValue](#_CPPv49CassValue) \*value)

Returns true if a specified value is null.

* **Parameters:**
  **value** – **[in]** 
* **Returns:**
  true if the value is null, otherwise false. 

### [cass_bool_t](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.BasicTypes.md#_CPPv411cass_bool_t) cass_value_is_collection(const [CassValue](#_CPPv49CassValue) \*value)

Returns true if a specified value is a collection.

* **Parameters:**
  **value** – **[in]** 
* **Returns:**
  true if the value is a collection, otherwise false. 

### [cass_bool_t](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.BasicTypes.md#_CPPv411cass_bool_t) cass_value_is_duration(const [CassValue](#_CPPv49CassValue) \*value)

Returns true if a specified value is a duration.

* **Parameters:**
  **value** – **[in]** 
* **Returns:**
  true if the value is a duration, otherwise false. 

### size_t cass_value_item_count(const [CassValue](#_CPPv49CassValue) \*collection)

Get the number of items in a collection. Works for all collection types.

* **Parameters:**
  **collection** – **[in]** 
* **Returns:**
  Count of items in a collection. 0 if not a collection. 

### [CassValueType](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.CassValueType.md#_CPPv413CassValueType) cass_value_primary_sub_type(const [CassValue](#_CPPv49CassValue) \*collection)

Get the primary sub-type for a collection. This returns the sub-type for a list or set and the key type for a map.

* **Parameters:**
  **collection** – **[in]** 
* **Returns:**
  The type of the primary sub-type. CASS_VALUE_TYPE_UNKNOWN returned if not a collection. 

### [CassValueType](https://cpp-rs-driver.docs.scylladb.com/v1.1.0/api/group.CassValueType.md#_CPPv413CassValueType) cass_value_secondary_sub_type(const [CassValue](#_CPPv49CassValue) \*collection)

Get the secondary sub-type for a collection. This returns the value type for a map.

* **Parameters:**
  **collection** – **[in]** 
* **Returns:**
  The type of the primary sub-type. CASS_VALUE_TYPE_UNKNOWN returned if not a collection or not a map.
