Skip to content

Optional support for empty mapsets

Compare
Choose a tag to compare
@darrenklein darrenklein released this 03 May 00:59

This minor version release includes optional support for empty mapsets, via the :empty_mapset_to_nil and :nil_to_empty_mapset configuration options. Quoth the README:

When a field contains a `DynamoDBSet` type and has a MapSet in it, by default the mapset must contain one or more values, otherwise an `insert` on the object will fail. This is due to DynamoDB not supporting empty sets. Setting this value to `true` will convert empty mapset values to `nil` before writting, allowing them to be written to DynamoDB as a null value.

**:nil_to_empty_mapset** :: boolean, *default:* `false`

When a field contains a `DynmamoDBSet` type, and the value in DynamoDB is null, setting this option causes the loaded value to be populated with an empty MapSet (the result of `MapSet.new()`) rather than being left as `nil`.