Sha256: 1edfcc76f9b78e2f93b251cd9b4d1b86af88bdac08ec67630309545e9400dbac

Contents?: true

Size: 1.39 KB

Versions: 62

Compression:

Stored size: 1.39 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:
        task_reports = yield(task)
        next_config_diff = {}
        return next_config_diff
      end

      #def self.resume(task, schema, count, &control)
      #  task_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
        task_report = {}
        return task_report
      end
    end

  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
embulk-0.7.10 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.7.10-java lib/embulk/data/new/ruby/output.rb.erb
embulk-0.7.9 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.7.9-java lib/embulk/data/new/ruby/output.rb.erb
embulk-0.7.8 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.7.8-java lib/embulk/data/new/ruby/output.rb.erb
embulk-0.7.7 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.7.7-java lib/embulk/data/new/ruby/output.rb.erb
embulk-0.7.6 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.7.6-java lib/embulk/data/new/ruby/output.rb.erb
embulk-0.7.5 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.7.5-java lib/embulk/data/new/ruby/output.rb.erb
embulk-0.7.4 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.7.4-java lib/embulk/data/new/ruby/output.rb.erb
embulk-0.7.3 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.7.3-java lib/embulk/data/new/ruby/output.rb.erb
embulk-0.7.2 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.7.2-java lib/embulk/data/new/ruby/output.rb.erb
embulk-0.7.1 lib/embulk/data/new/ruby/output.rb.erb
embulk-0.7.1-java lib/embulk/data/new/ruby/output.rb.erb