go_embulk

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2020 License: MIT Imports: 3 Imported by: 0

README

Go-Embulk

Implementation Embulk in Go.

Usage

package main

import (
	"bytes"
	"io"
	"log"
	"os"

	"github.com/garupanojisan/go-embulk"
)

func main() {
	g := &go_embulk.GoEmbulk{
		Input: bytes.NewBufferString("hello go-embulk"),
		Outputs: []io.Writer{
			os.Stdout,
		},
	}

	if err := g.Run(); err != nil {
		log.Fatal(err)
	}
}

Input

Input struct should implements io.Reader.

For example,

type ExampleInput struct {
}

func (s *ExampleInput) Read(p []byte) error {
    // do something (e.g. initialization, authentication, etc...)
    
    // set data into p

    // do something
}

Output

Output struct should implements io.Writer.

type ExampleOutput struct {
}

func (s *ExampleOutput) Write(data []byte) (int, error) {
    // do something (e.g. initialization, authentication, etc...)
    
    // write data

    // do something
}

Documentation

Index

Constants

View Source
const MinRead int = 512

Variables

This section is empty.

Functions

This section is empty.

Types

type GoEmbulk

type GoEmbulk struct {
	Input   Input
	Outputs []Output
}

func (*GoEmbulk) Run

func (g *GoEmbulk) Run() error

type Input added in v0.0.2

type Input interface {
	io.Reader
	Init() error
	Finalize() error
}

type Output added in v0.0.2

type Output interface {
	io.Writer
	Init() error
	Finalize() error
}

Directories

Path Synopsis
example
plugins

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL