@@ -178,6 +178,26 @@ def rollback
178178 # When a model is not persisted - its id should have unique value.
179179 # Otherwise a transaction will be rolled back.
180180 #
181+ # Raises +Dynamoid::Errors::MissingHashKey+ if a model is already persisted
182+ # and a partition key has value +nil+ and raises
183+ # +Dynamoid::Errors::MissingRangeKey+ if a sort key is required but has
184+ # value +nil+.
185+ #
186+ # There are the following differences between transactional and
187+ # non-transactional +#save!+:
188+ # - transactional +#save!+ doesn't support the +:touch+ option
189+ # - transactional +#save!+ doesn't support +lock_version+ attribute so it
190+ # will not be incremented and will not be checked to detect concurrent
191+ # modification of a model and +Dynamoid::Errors::StaleObjectError+
192+ # exception will not be raised
193+ # - transactional +#save!+ doesn't raise +Dynamoid::Errors::RecordNotUnique+
194+ # at saving new model when primary key is already used. A generic
195+ # +Aws::DynamoDB::Errors::TransactionCanceledException+ is raised instead.
196+ # - transactional +save!+ doesn't raise
197+ # +Dynamoid::Errors::StaleObjectError+ when a model that is being updated
198+ # was concurrently deleted
199+ # - a table isn't created lazily if it doesn't exist yet
200+ #
181201 # @param model [Dynamoid::Document] a model
182202 # @param options [Hash] (optional)
183203 # @option options [true|false] :validate validate a model or not - +true+ by default (optional)
@@ -216,6 +236,25 @@ def save!(model, **options)
216236 # When a model is not persisted - its id should have unique value.
217237 # Otherwise a transaction will be rolled back.
218238 #
239+ # Raises +Dynamoid::Errors::MissingHashKey+ if a model is already persisted
240+ # and a partition key has value +nil+ and raises
241+ # +Dynamoid::Errors::MissingRangeKey+ if a sort key is required but has
242+ # value +nil+.
243+ #
244+ # There are the following differences between transactional and
245+ # non-transactional +#save+:
246+ # - transactional +#save+ doesn't support the +:touch+ option
247+ # - transactional +#save+ doesn't support +lock_version+ attribute so it
248+ # will not be incremented and will not be checked to detect concurrent
249+ # modification of a model and +Dynamoid::Errors::StaleObjectError+
250+ # exception will not be raised
251+ # - transactional +#save+ doesn't raise +Dynamoid::Errors::RecordNotUnique+
252+ # at saving new model when primary key is already used. A generic
253+ # +Aws::DynamoDB::Errors::TransactionCanceledException+ is raised instead.
254+ # - transactional +save+ doesn't raise +Dynamoid::Errors::StaleObjectError+
255+ # when a model that is being updated was concurrently deleted
256+ # - a table isn't created lazily if it doesn't exist yet
257+ #
219258 # @param model [Dynamoid::Document] a model
220259 # @param options [Hash] (optional)
221260 # @option options [true|false] :validate validate a model or not - +true+ by default (optional)
@@ -248,6 +287,20 @@ def save(model, **options)
248287 #
249288 # Validates model and runs callbacks.
250289 #
290+ # Raises +Dynamoid::Errors::MissingRangeKey+ if a sort key is required but
291+ # not specified or has value +nil+.
292+ #
293+ # There are the following differences between transactional and
294+ # non-transactional +#create+:
295+ # - transactional +#create!+ doesn't support +lock_version+ attribute so it
296+ # will not be incremented and will not be checked to detect concurrent
297+ # modification of a model and +Dynamoid::Errors::StaleObjectError+
298+ # exception will not be raised
299+ # - transactional +#create!+ doesn't raise +Dynamoid::Errors::RecordNotUnique+
300+ # at saving new model when primary key is already used. A generic
301+ # +Aws::DynamoDB::Errors::TransactionCanceledException+ is raised instead.
302+ # - a table isn't created lazily if it doesn't exist yet
303+ #
251304 # @param model_class [Class] a model class which should be instantiated
252305 # @param attributes [Hash|Array<Hash>] attributes of a model
253306 # @param block [Proc] a block to process a model after initialization
@@ -287,6 +340,20 @@ def create!(model_class, attributes = {}, &block)
287340 #
288341 # Validates model and runs callbacks.
289342 #
343+ # Raises +Dynamoid::Errors::MissingRangeKey+ if a sort key is required but
344+ # not specified or has value +nil+.
345+ #
346+ # There are the following differences between transactional and
347+ # non-transactional +#create+:
348+ # - transactional +#create+ doesn't support +lock_version+ attribute so it
349+ # will not be incremented and will not be checked to detect concurrent
350+ # modification of a model and +Dynamoid::Errors::StaleObjectError+
351+ # exception will not be raised
352+ # - transactional +#create+ doesn't raise +Dynamoid::Errors::RecordNotUnique+
353+ # at saving new model when primary key is already used. A generic
354+ # +Aws::DynamoDB::Errors::TransactionCanceledException+ is raised instead.
355+ # - a table isn't created lazily if it doesn't exist yet
356+ #
290357 # @param model_class [Class] a model class which should be instantiated
291358 # @param attributes [Hash|Array<Hash>] attributes of a model
292359 # @param block [Proc] a block to process a model after initialization
@@ -322,6 +389,17 @@ def create(model_class, attributes = {}, &block)
322389 # Raises a +Dynamoid::Errors::UnknownAttribute+ exception if any of the
323390 # attributes is not declared in the model class.
324391 #
392+ # Raises +Dynamoid::Errors::MissingHashKey+ if a partition key has value
393+ # +nil+ and +Dynamoid::Errors::MissingRangeKey+ if a sort key is required
394+ # but has value +nil+.
395+ #
396+ # There are the following differences between transactional and
397+ # non-transactional +#upsert+:
398+ # - transactional +#upsert+ doesn't support conditions (that's +if+ and
399+ # +unless_exists+ options)
400+ # - transactional +#upsert+ doesn't return a document that was updated or
401+ # created
402+ #
325403 # @param model_class [Class] a model class
326404 # @param hash_key [Scalar value] hash key value
327405 # @param range_key [Scalar value] range key value (optional)
@@ -395,6 +473,17 @@ def upsert(model_class, hash_key, range_key = nil, attributes) # rubocop:disable
395473 # Raises a +Dynamoid::Errors::UnknownAttribute+ exception if any of the
396474 # attributes is not declared in the model class.
397475 #
476+ # Raises +Dynamoid::Errors::MissingHashKey+ if a partition key has value
477+ # +nil+ and +Dynamoid::Errors::MissingRangeKey+ if a sort key is required
478+ # but has value +nil+.
479+ #
480+ # There are the following differences between transactional and
481+ # non-transactional +#update_fields+:
482+ # - transactional +#update_fields+ doesn't support conditions (that's +if+
483+ # and +unless_exists+ options)
484+ # - transactional +#update_fields+ doesn't return a document that was
485+ # updated or created
486+ #
398487 # @param model_class [Class] a model class
399488 # @param hash_key [Scalar value] hash key value
400489 # @param range_key [Scalar value] range key value (optional)
@@ -420,6 +509,21 @@ def update_fields(model_class, hash_key, range_key = nil, attributes = nil, &blo
420509 # Returns +true+ if saving is successful and +false+
421510 # otherwise.
422511 #
512+ # Raises +Dynamoid::Errors::MissingHashKey+ if a partition key has value
513+ # +nil+ and raises +Dynamoid::Errors::MissingRangeKey+ if a sort key is
514+ # required but has value +nil+.
515+ #
516+ # There are the following differences between transactional and
517+ # non-transactional +#update_attributes+:
518+ # - transactional +#update_attributes+ doesn't support +lock_version+ attribute so it
519+ # will not be incremented and will not be checked to detect concurrent
520+ # modification of a model and +Dynamoid::Errors::StaleObjectError+
521+ # exception will not be raised
522+ # - transactional +update_attributes+ doesn't raise
523+ # +Dynamoid::Errors::StaleObjectError+ when a model that is being updated
524+ # was concurrently deleted
525+ # - a table isn't created lazily if it doesn't exist yet
526+ #
423527 # @param model [Dynamoid::Document] a model
424528 # @param attributes [Hash] a hash of attributes to update
425529 # @return [true|false] Whether updating successful or not
@@ -440,6 +544,21 @@ def update_attributes(model, attributes)
440544 # Raises a +Dynamoid::Errors::DocumentNotValid+ exception if some vaidation
441545 # fails.
442546 #
547+ # Raises +Dynamoid::Errors::MissingHashKey+ if a partition key has value
548+ # +nil+ and raises +Dynamoid::Errors::MissingRangeKey+ if a sort key is
549+ # required but has value +nil+.
550+ #
551+ # There are the following differences between transactional and
552+ # non-transactional +#update_attributes!+:
553+ # - transactional +#update_attributes!+ doesn't support +lock_version+
554+ # attribute so it will not be incremented and will not be checked to detect
555+ # concurrent modification of a model and
556+ # +Dynamoid::Errors::StaleObjectError+ exception will not be raised
557+ # - transactional +update_attributes!+ doesn't raise
558+ # +Dynamoid::Errors::StaleObjectError+ when a model that is being updated
559+ # was concurrently deleted
560+ # - a table isn't created lazily if it doesn't exist yet
561+ #
443562 # @param model [Dynamoid::Document] a model
444563 # @param attributes [Hash] a hash of attributes to update
445564 def update_attributes! ( model , attributes )
@@ -461,7 +580,18 @@ def update_attributes!(model, attributes)
461580 # t.delete(User, user_id)
462581 # end
463582 #
464- # Raise +MissingRangeKey+ if a range key is declared but not passed as argument.
583+ # Raises +Dynamoid::Errors::MissingHashKey+ if a partition key has value
584+ # +nil+ and raises +Dynamoid::Errors::MissingRangeKey+ if a sort key is
585+ # required but has value +nil+.
586+ #
587+ # There are the following differences between transactional and
588+ # non-transactional +#delete+: TBD
589+ # - transactional +#delete+ doesn't support +lock_version+ attribute so it
590+ # will not be incremented and will not be checked to detect concurrent
591+ # modification of a model and +Dynamoid::Errors::StaleObjectError+
592+ # exception will not be raised
593+ # - transactional +#delete+ doesn't disassociate a model from associated ones
594+ # if there is any
465595 #
466596 # @param model_or_model_class [Class|Dynamoid::Document] either model or model class
467597 # @param hash_key [Scalar value] hash key value
@@ -483,6 +613,19 @@ def delete(model_or_model_class, hash_key = nil, range_key = nil)
483613 # Raises +Dynamoid::Errors::RecordNotDestroyed+ exception if model deleting
484614 # failed (e.g. aborted by a callback).
485615 #
616+ # Raises +Dynamoid::Errors::MissingHashKey+ if a partition key has value
617+ # +nil+ and raises +Dynamoid::Errors::MissingRangeKey+ if a sort key is
618+ # required but has value +nil+.
619+ #
620+ # There are the following differences between transactional and
621+ # non-transactional +#destroy!+:
622+ # - transactional +#destroy!+ doesn't support +lock_version+ attribute so it
623+ # will not be incremented and will not be checked to detect concurrent
624+ # modification of a model and +Dynamoid::Errors::StaleObjectError+
625+ # exception will not be raised
626+ # - transactional +#destroy!+ doesn't disassociate a model from associated ones
627+ # if there are association declared in the model class
628+ #
486629 # @param model [Dynamoid::Document] a model
487630 # @return [Dynamoid::Document|false] returns self if destoying is succefull, +false+ otherwise
488631 def destroy! ( model )
@@ -494,6 +637,19 @@ def destroy!(model)
494637 #
495638 # Runs callbacks.
496639 #
640+ # Raises +Dynamoid::Errors::MissingHashKey+ if a partition key has value
641+ # +nil+ and raises +Dynamoid::Errors::MissingRangeKey+ if a sort key is
642+ # required but has value +nil+.
643+ #
644+ # There are the following differences between transactional and
645+ # non-transactional +#destroy+:
646+ # - transactional +#destroy+ doesn't support +lock_version+ attribute so it
647+ # will not be incremented and will not be checked to detect concurrent
648+ # modification of a model and +Dynamoid::Errors::StaleObjectError+
649+ # exception will not be raised
650+ # - transactional +#destroy+ doesn't disassociate a model from associated ones
651+ # if there are association declared in the model class
652+ #
497653 # @param model [Dynamoid::Document] a model
498654 # @return [Dynamoid::Document] self
499655 def destroy ( model )
0 commit comments