module TinyDyno::Expected

Public Instance Methods

request_as_new_record(request) click to toggle source

insert Expected clause, which will ensure that INSERTs will only take place if there is no record with that hash key yet

# File lib/tiny_dyno/expected.rb, line 8
def request_as_new_record(request)
  request.merge({
                    expected: {
                        "#{ primary_key[:attribute_name] }": {
                            comparison_operator: 'NULL'
                        }
                    }})
end