Supported data types
For the complete documentation index see: llms.txt
All documentation pages available in markdown.
The Aerospike Database supports these native types:
Click to view data types
- Blob
- Boolean
- Bytes
- Double
- Float
- GeoJSON
- HyperLogLog
- Integer
- List
- Map
- OrderedMap
- String
When setting a value in Rust, the Aerospike library automatically determines the best native Aerospike data type for storage:
- Integers of all types up to and including
i64::MAXare converted to 64-bit numerics. u64values are not supported as record bin values and need to be cast to one of the other supported integer types.u64values can be stored as elements or keys in lists and maps.- A
u64value or key abovei64::MAXpanics on conversion. Earlier client versions silently wrapped the value to a negative integer instead. - Floating point values are stored in 64-bit IEEE-754 format. Converting a
FloatValue::F32tof64widens the value; converting aFloatValue::F64tof32narrows it by value (for example,2.25_f64narrows to2.25_f32, not a bit-reinterpreted result). - Strings are stored as opaque byte arrays but de-serialized as UTF-8 strings when reading from the database.
- Byte arrays are stored as blobs.
Reading bin values
Bins in a Record are stored as aerospike::Value. To extract a typed Rust value, use TryFrom (or pattern match on the enum):
use aerospike::Value;
// Extract a string bin (returns None if the bin is missing or not a string)let name: String = record .bins .get("name") .and_then(|v| String::try_from(v.clone()).ok()) .unwrap_or_else(|| "unknown".to_string());
// Extract an integer binlet age: i64 = record .bins .get("age") .and_then(|v| i64::try_from(v.clone()).ok()) .unwrap_or(0);Alternatively, match directly on the variant:
match record.bins.get("name") { Some(Value::String(s)) => s.clone(), _ => "unknown".to_string(),}