Sha256: 888897ce8557f1d100a49575cb5a36272521d01f826c3406f90703a038b599ec

Contents?: true

Size: 1.21 KB

Versions: 5

Compression:

Stored size: 1.21 KB

Contents

module Embulk
  module Output

    class <%= ruby_class_name %> < OutputPlugin
      Plugin.register_output(<%= name.dump %>, self)

      def self.transaction(config, schema, count, &control)
        # configuration code:
        task = {
          "property1" => config.param("property1", :string)
          "property2" => config.param("property2", :integer, default: 0)
        }

        # resumable output:
        # resume(task, schema, count, &control)

        # non-resumable output:
        commit_reports = yield(task)
        next_config_diff = {}
        return next_config_diff
      end

      #def self.resume(task, schema, count, &control)
      #  commit_reports = yield(task)
      #
      #  next_config_diff = {}
      #  return next_config_diff
      #end

      def init
        # initialization code:
        @property1 = task["property1"]
        @property2 = task["property2"]
      end

      def close
      end

      def add(page)
        # output code:
        page.each do |record|
          #hash = Hash[schema.names.zip(record)]
        end
      end

      def finish
      end

      def abort
      end

      def commit
        commit_report = {}
        return commit_report
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
embulk-0.4.4 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.4.3 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.4.2 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.4.1 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.4.0 lib/embulk/data/new/ruby/output.rb.erb