Sha256: b71617ffb2dece7c038d6163e93a452758cb311a40f712089e3b41e582da1071

Contents?: true

Size: 1.1 KB

Versions: 5

Compression:

Stored size: 1.1 KB

Contents

module Embulk
  module Input

    class <%= ruby_class_name %> < InputPlugin
      Plugin.register_input(<%= name.dump %>, self)

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

        columns = [
          Column.new(0, "example", :string),
          Column.new(1, "column", :long),
          Column.new(2, "name", :double),
        ]

        resume(task, columns, 1, &control)
      end

      def self.resume(task, columns, count, &control)
        commit_reports = yield(task, columns, count)

        next_config_diff = {}
        return next_config_diff
      end

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

      def run
        page_builder.add(["example-value", 1, 0.1])
        page_builder.add(["example-value", 2, 0.2])
        page_builder.finish

        commit_report = {}
        return commit_report
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
embulk-0.4.10 lib/embulk/data/new/ruby/input.rb.erb
embulk-0.4.9 lib/embulk/data/new/ruby/input.rb.erb
embulk-0.4.8 lib/embulk/data/new/ruby/input.rb.erb
embulk-0.4.7 lib/embulk/data/new/ruby/input.rb.erb
embulk-0.4.6 lib/embulk/data/new/ruby/input.rb.erb