Class: Dynamoid::TransactionWrite::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/dynamoid/transaction_write/base.rb

Instance Method Summary collapse

Instance Method Details

#aborted?Boolean

Whether some callback aborted or canceled an action

Returns:

  • (Boolean)


26
27
28
# File 'lib/dynamoid/transaction_write/base.rb', line 26

def aborted?
  raise 'Not implemented'
end

#action_requestObject

Coresponding part of a final request body



42
43
44
# File 'lib/dynamoid/transaction_write/base.rb', line 42

def action_request
  raise 'Not implemented'
end

#observable_by_user_resultObject

Value returned to a user as an action result



37
38
39
# File 'lib/dynamoid/transaction_write/base.rb', line 37

def observable_by_user_result
  raise 'Not implemented'
end

#on_commitObject

Callback called after changes are persisted. It’s a proper place to mark changes in a model as applied.



15
16
17
# File 'lib/dynamoid/transaction_write/base.rb', line 15

def on_commit
  raise 'Not implemented'
end

#on_registrationObject

Callback called at “initialization” or “registration” an action before changes are persisted. It’s a proper place to validate a model or run callbacks



9
10
11
# File 'lib/dynamoid/transaction_write/base.rb', line 9

def on_registration
  raise 'Not implemented'
end

#on_rollbackObject

Callback called when a transaction is rolled back. It’s a proper place to undo changes made in after_… callbacks.



21
22
23
# File 'lib/dynamoid/transaction_write/base.rb', line 21

def on_rollback
  raise 'Not implemented'
end

#sanitize_item(attributes) ⇒ Object

copied from aws_sdk_v3



47
48
49
50
51
52
53
54
55
56
# File 'lib/dynamoid/transaction_write/base.rb', line 47

def sanitize_item(attributes)
  config_value = Dynamoid.config.store_attribute_with_nil_value
  store_attribute_with_nil_value = config_value.nil? ? false : !!config_value

  attributes.reject do |_, v|
    !store_attribute_with_nil_value && v.nil?
  end.transform_values do |v|
    v.is_a?(Hash) ? v.stringify_keys : v
  end
end

#skipped?Boolean

Whether there are changes to persist, e.g. updating a model with no attribute changed is skipped.

Returns:

  • (Boolean)


32
33
34
# File 'lib/dynamoid/transaction_write/base.rb', line 32

def skipped?
  raise 'Not implemented'
end