Sha256: b883fadcbe24b45f89373becd8c526004cf335e71ddfbbb8d7c08469cf9cdb66

Contents?: true

Size: 323 Bytes

Versions: 9

Compression:

Stored size: 323 Bytes

Contents

# frozen_string_literal: true

class Riddle::Query::Delete
  def initialize(index, *ids)
    @index = index
    @ids   = ids.flatten
  end
  
  def to_sql
    if @ids.length > 1
      "DELETE FROM #{@index} WHERE id IN (#{@ids.join(', ')})"
    else
      "DELETE FROM #{@index} WHERE id = #{@ids.first}"
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
riddle-2.4.3 lib/riddle/query/delete.rb
riddle-2.4.2 lib/riddle/query/delete.rb
riddle-2.4.1 lib/riddle/query/delete.rb
riddle-2.4.0 lib/riddle/query/delete.rb
riddle-2.3.2 lib/riddle/query/delete.rb
riddle-2.3.1 lib/riddle/query/delete.rb
riddle-2.3.0 lib/riddle/query/delete.rb
riddle-2.2.2 lib/riddle/query/delete.rb
riddle-2.2.1 lib/riddle/query/delete.rb