writers

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2015 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package writers provides objects that can send colected resource data to external place.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	ReadersData   map[string]interface{}
	Data          map[string]interface{}
	JsonProcessor string
}

func (*Base) GetJsonProcessor

func (b *Base) GetJsonProcessor() string

GetJsonProcessor returns json processor path.

func (*Base) GetReadersData

func (b *Base) GetReadersData() map[string]interface{}

GetReadersData returns ReadersData field.

func (*Base) Run

func (b *Base) Run() error

Run executes the writer.

func (*Base) SetReadersData

func (b *Base) SetReadersData(readersData map[string]interface{})

SetReadersData assigns ReadersData field.

func (*Base) SetReadersDataInBytes

func (b *Base) SetReadersDataInBytes(readersJsonBytes map[string][]byte)

SetReadersDataInBytes pulls readers data and store them on ReadersData field.

func (*Base) ToJson

func (b *Base) ToJson() ([]byte, error)

ToJson serialize Data field to JSON.

type Http

type Http struct {
	Base
	Url      string
	Method   string
	Headers  string
	Username string
	Password string
}

Http is a writer that simply serialize all readers data to Http.

func NewHttp

func NewHttp() *Http

NewHttp is Http constructor.

func (*Http) NewHttpRequest

func (h *Http) NewHttpRequest(dataJson []byte) (*http.Request, error)

NewHttpRequest builds and returns http.Request struct.

func (*Http) Run

func (h *Http) Run() error

Run executes the writer.

type IWriter

type IWriter interface {
	Run() error
	SetReadersDataInBytes(map[string][]byte)
	SetReadersData(map[string]interface{})
	GetReadersData() map[string]interface{}
	GetJsonProcessor() string
	ToJson() ([]byte, error)
}

IWriter is general interface for writer.

func NewGoStruct

func NewGoStruct(name string) (IWriter, error)

NewGoStruct instantiates IWriter

func NewGoStructByConfig

func NewGoStructByConfig(config resourced_config.Config) (IWriter, error)

NewGoStructByConfig instantiates IWriter given Config struct

type ResourcedMaster

type ResourcedMaster struct {
	Http
}

ResourcedMaster is a writer that simply serialize all readers data to ResourcedMaster.

func NewResourcedMaster

func NewResourcedMaster() *ResourcedMaster

NewResourcedMaster is ResourcedMaster constructor.

func (*ResourcedMaster) Run

func (rm *ResourcedMaster) Run() error

Run pushes every reader data to ResourcedMaster keyed by reader's key itself.

type StdOut

type StdOut struct {
	Base
}

StdOut is a writer that simply serialize all readers data to STDOUT.

func NewStdOut

func NewStdOut() *StdOut

NewStdOut is StdOut constructor.

func (*StdOut) Run

func (s *StdOut) Run() error

Run puts all readers data to STDOUT.

Jump to

Keyboard shortcuts

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