Sha256: eb230ede080ad3633e03fd3385cf5b4eb96e4f2b982523420a6f0b3835f1571b

Contents?: true

Size: 571 Bytes

Versions: 25

Compression:

Stored size: 571 Bytes

Contents

require 'rom/sql/commands/error_wrapper'
require 'rom/sql/commands/transaction'

module ROM
  module SQL
    module Commands
      # SQL delete command
      #
      # @api public
      class Delete < ROM::Commands::Delete
        adapter :sql

        include Transaction
        include ErrorWrapper

        # Deletes tuples from a relation
        #
        # @return [Array<Hash>] deleted tuples
        #
        # @api public
        def execute
          deleted = relation.to_a
          relation.delete
          deleted
        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
rom-sql-1.0.0.beta2 lib/rom/sql/commands/delete.rb
rom-sql-1.0.0.beta1 lib/rom/sql/commands/delete.rb
rom-sql-0.9.1 lib/rom/sql/commands/delete.rb
rom-sql-0.9.0 lib/rom/sql/commands/delete.rb
rom-sql-0.8.0 lib/rom/sql/commands/delete.rb