Hi,
I'm new to Rust and Dynomite. Have some experience with DynamoDB.
Hope my question makes sense.
I'd like to have an item with an attribute of type HashSet.
#[derive(Item, Debug, Clone)]
struct User {
#[dynomite(partition_key)]
id: String,
friends: HashSet<String>
}
When I try to create such an item in DynamoDB it seems like the hashset is translated to an attribute of type SS with an empty set of values { "SS": [] }. This is not permitted by DynamoDB and returns an error.
Alternatively, when I define the attribute as an Option (initialized to None) the resulting Item has a NULL attribute { "NULL": true }
#[derive(Item, Debug, Clone)]
struct User {
#[dynomite(partition_key)]
id: String,
friends: Option<HashSet<String>>
}
The challenge with the NULL attribute is that subsequent update expressions such as "ADD friends :v" no longer work, as the attribute type is not a Set.
Any advice / best-practices ?
Thanks,
Hi,
I'm new to Rust and Dynomite. Have some experience with DynamoDB.
Hope my question makes sense.
I'd like to have an item with an attribute of type HashSet.
When I try to create such an item in DynamoDB it seems like the hashset is translated to an attribute of type SS with an empty set of values { "SS": [] }. This is not permitted by DynamoDB and returns an error.
Alternatively, when I define the attribute as an Option (initialized to None) the resulting Item has a NULL attribute { "NULL": true }
The challenge with the NULL attribute is that subsequent update expressions such as "ADD friends :v" no longer work, as the attribute type is not a Set.
Any advice / best-practices ?
Thanks,