Sha256: 449d1bbaa61cc47d054a08aad74089b87ba1ecd5496ef77ec081be682ba5ebb2

Contents?: true

Size: 654 Bytes

Versions: 2

Compression:

Stored size: 654 Bytes

Contents

# frozen_string_literal: true

module Ductr
  module SequelBase
    #
    # A lookup control that execute one query per row.
    #
    class BasicLookup < Ductr::ETL::Transform
      #
      # Calls the job's method to merge its result with the current row.
      #
      # @param [Hash<Symbol, Object>] row The current row, preferably a Hash
      #
      # @return [Hash<Symbol, Object>] The row merged with looked up row or the untouched row if nothing was found
      #
      def process(row)
        matching_row = call_method(adapter.db, row).first
        return row unless matching_row

        row.merge matching_row
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ductr-0.2.3 lib/ductr/sequel_base/basic_lookup.rb
ductr-0.2.2 lib/ductr/sequel_base/basic_lookup.rb