Official repository for the aws-record gem, an abstraction for Amazon DynamoDB.
APACHE-2.0 License
Bot releases are hidden (Show)
Published by awood45 over 7 years ago
References: #71
Feature - Support lambdas for default attribute values.
date_attr :date, default_value -> { Date.today }
Issue - An attribute's default_value could be modified and carried over to
new instances of the model. With this change, default values are deep copied,
and are hydrated at item creation to ensure correct persistence of mutable
objects.
Published by awood45 over 7 years ago
References: #51, #52, #64
Feature - Aws::Record::TableConfig - A declarative way to describe
configuration for your Amazon DynamoDB tables, with smart migrations based on
the current remote state. More details in the documentation.
Issue - Aws::Record::TableMigration - Legacy table migrations could have
issues with global secondary indexes if a table was deleted and recreated
multiple times.
Published by awood45 almost 8 years ago
References: #38, #46, #49
find_with_opts
class methodfind
)Aws::DynamoDB::Client#get_item
call.Published by awood45 almost 8 years ago
References: #43
REMOVE
expressions failed due to an empty:expression_attribute_values
map. The fix makes the presence of that mapPublished by awood45 about 8 years ago
References: #32, #36
#empty?
implementation,false
for a response which is, in fact, empty.Published by awood45 about 8 years ago
#table_exists?
and #provisioned_throughput
#table_name
.Published by awood45 about 8 years ago
References: #30
Published by awood45 about 8 years ago
References: #26, #27, #28, #29
Feature - Aws::Attribute - Added support for default values at the attribute
level.
Feature - Aws::Marshalers - Removed the marshalers in the Aws::Attributes
namespace, replacing them with instantiated marshaler objects. This enables
more functionality in marshalers such as the Date/DateTime marshalers.
Feature - Aws::Record::DirtyTracking - Improves dirty tracking by adding
support for tracking mutations of attribute value objects. This feature is on
by default for the "collection" types: :list_attr
, :map_attr
,
:string_set_attr
, and :numeric_set_attr
.
Before this feature, the #save
method's default behavior of running an
update call for dirty attributes only could cause problems for users of
collection attributes. As many of them are commonly manipulated using mutable
state, the underlying "clean" version of the objects would be modified and the
updated object would not be recognized as dirty, and therefore would not be
updated at all unless explicitly marked as dirty or through a force put.
class Model
include Aws::Record
string_attr :uuid, hash_key: true
list_attr :collection
end
item = Model.new(uuid: SecureRandom.uuid, collection: [1,2,3])
item.clean! # As if loaded from the database, to demonstrate the new tracking.
item.dirty? # => false
item.collection << 4 # In place mutation of the "collection" array.
item.dirty? # => true (Previous versions would not recognize this as dirty.
item.save # Would call Aws::DynamoDB::Client#update_item for :collection only.
Note that this feature is implemented using deep copies of collection objects
in memory, so there is a potential memory/performance hit in exchange for the
added accuracy. As such, mutation tracking can be explicitly turned off at the
attribute level or at the full model level, if desired.
# Note that the disabling of mutation tracking is redundant in this example,
# for illustration purposes.
class Model
include Aws::Record
disable_mutation_tracking # For turning off mutation at the model level.
string_attr :uuid, hash_key: true
list_attr :collection, mutation_tracking: false # Turn off at attr level.
end