Sha256: 4a6098ba4bf06bb18a6815056a6ae92df75fb91166f36c5d0c6c8cbe1c283e9e

Contents?: true

Size: 1.4 KB

Versions: 11

Compression:

Stored size: 1.4 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 = {
          "option1" => config.param("option1", :integer),                     # integer, required
          "option2" => config.param("option2", :string, default: "myvalue"),  # string, optional
          "option3" => config.param("option3", :string, default: nil),        # string, optional
        }

        # 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:
        @option1 = task["option1"]
        @option2 = task["option2"]
        @option3 = task["option3"]
      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

11 entries across 11 versions & 1 rubygems

Version Path
embulk-0.6.27 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.6.26 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.6.25 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.6.24 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.6.23 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.6.22 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.6.21 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.6.20 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.6.19 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.6.18 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.6.17 lib/embulk/data/new/ruby/output.rb.erb