Sha256: 93ab302fd9049c22bd4a6b3cf98e1b2f0f3b150141fd99b5f22a5062b98a41be

Contents?: true

Size: 486 Bytes

Versions: 1

Compression:

Stored size: 486 Bytes

Contents

module PostgresUpsert
  class Result
    attr_reader :inserted, :updated

    def initialize(insert_result, update_result, copy_result)
      @inserted = insert_result ? insert_result.cmd_tuples : 0
      @updated = update_result ? update_result.cmd_tuples : 0  
      @copied = copy_result ? copy_result.cmd_tuples : 0  
    end

    def changed_rows
      @inserted + @updated
    end

    def copied_rows
      @copied
    end

    def updated_rows
      @updated
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
postgres_upsert-5.0.0 lib/postgres_upsert/result.rb