Module: Commutator::Util::Placeholders

Defined in:
lib/commutator/util/placeholders.rb

Overview

Provides a placeholder string for a name or value for use in DynamoDB expressions.

Name placeholders will return the name itself if it is not a reserved word (and therefore safe to use).

Value placeholders are always generated.

Class Method Summary collapse

Class Method Details

.name(name) ⇒ Object



17
18
19
# File 'lib/commutator/util/placeholders.rb', line 17

def self.name(name)
  RESERVED_WORDS.include?(name.downcase) ? "#N_#{hash(name)}" : name
end

.value(value) ⇒ Object



13
14
15
# File 'lib/commutator/util/placeholders.rb', line 13

def self.value(value)
  ":V_#{hash(value)}"
end