Sha256: 04a56715667523a7bef2e97a9625ea7f4bfd02829be0ca6b6fa009d4cb71ecd3
Contents?: true
Size: 650 Bytes
Versions: 9
Compression:
Stored size: 650 Bytes
Contents
require 'cassanity/increment' require 'cassanity/decrement' module Cassanity module ArgumentGenerators class SetClause # Internal def call(args = {}) set = args.fetch(:set) cql, variables, sets = '', [], [] set.each do |key, value| case value when Cassanity::Increment, Cassanity::Decrement sets << "#{key} = #{key} #{value.symbol} ?" variables << value.value else sets << "#{key} = ?" variables << value end end cql << " SET #{sets.join(', ')}" [cql, *variables] end end end end
Version data entries
9 entries across 9 versions & 1 rubygems