Class: Dynamoid::Transactions::Mutation::DeleteWithInstance
- Inherits:
-
Base
- Object
- Base
- Dynamoid::Transactions::Mutation::DeleteWithInstance
show all
- Defined in:
- lib/dynamoid/transactions/mutation/delete_with_instance.rb
Instance Method Summary
collapse
Methods inherited from Base
validate_attribute_names!
Constructor Details
Returns a new instance of DeleteWithInstance.
11
12
13
14
15
16
|
# File 'lib/dynamoid/transactions/mutation/delete_with_instance.rb', line 11
def initialize(model)
super()
@model = model
@model_class = model.class
end
|
Instance Method Details
#aborted? ⇒ Boolean
31
32
33
|
# File 'lib/dynamoid/transactions/mutation/delete_with_instance.rb', line 31
def aborted?
false
end
|
#action_requests ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/dynamoid/transactions/mutation/delete_with_instance.rb', line 43
def action_requests
builder = Builders::DeleteRequestBuilder.new(@model_class)
builder.hash_key = dump_attribute(@model_class.hash_key, @model.hash_key)
builder.range_key = dump_attribute(@model_class.range_key, @model.range_value) if @model_class.range_key?
if @model_class.attributes[:lock_version]
lock_version = if @model.changes[:lock_version].nil?
@model.lock_version
else
@model.changes[:lock_version][0]
end
if lock_version
builder.add_expression_attribute_name('#_lock_version', 'lock_version')
builder.add_expression_attribute_value(':lock_version_value', lock_version)
builder.condition_expression = '#_lock_version = :lock_version_value'
end
end
[builder.request]
end
|
#observable_by_user_result ⇒ Object
39
40
41
|
# File 'lib/dynamoid/transactions/mutation/delete_with_instance.rb', line 39
def observable_by_user_result
@model
end
|
#on_commit ⇒ Object
22
23
24
25
|
# File 'lib/dynamoid/transactions/mutation/delete_with_instance.rb', line 22
def on_commit
@model.destroyed = true
@model.run_callbacks(:commit)
end
|
#on_registration ⇒ Object
18
19
20
|
# File 'lib/dynamoid/transactions/mutation/delete_with_instance.rb', line 18
def on_registration
validate_model!
end
|
#on_rollback ⇒ Object
27
28
29
|
# File 'lib/dynamoid/transactions/mutation/delete_with_instance.rb', line 27
def on_rollback
@model.run_callbacks(:rollback)
end
|
#skipped? ⇒ Boolean
35
36
37
|
# File 'lib/dynamoid/transactions/mutation/delete_with_instance.rb', line 35
def skipped?
false
end
|