transformer

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2017 License: BSD-3-Clause Imports: 12 Imported by: 0

README

transformer adaptor

The transformer adaptor receives and sends data through the defined javascript function for processing.

Configuration:
- logtransformer:
    filename: test/transformers/passthrough_and_log.js
    type: transformer

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// file containing transformer javascript
	// must define a module.exports = function(doc) { .....; return doc }
	Filename  string `json:"filename" doc:"the filename containing the javascript transform fn"`
	Namespace string `json:"namespace" doc:"namespace to transform"`

	// verbose output
	Debug bool `json:"debug" doc:"display debug information"` // debug mode
}

Config holds config options for a transformer adaptor

type Transformer

type Transformer struct {
	// contains filtered or unexported fields
}

Transformer is an adaptor which consumes data from a source, transforms it using a supplied javascript function and then emits it. The javascript transformation function is supplied as a separate file on disk, and is called by calling the defined module.exports function

func (*Transformer) Connect

func (t *Transformer) Connect() error

Connect loads the transformer file and initializes the transformer environment

func (*Transformer) Description

func (t *Transformer) Description() string

Description for transformer adaptor

func (*Transformer) Listen

func (t *Transformer) Listen() (err error)

Listen starts the transformer's listener, reads each message from the incoming channel transformers it into mejson, and then uses the supplied javascript module.exports function to transform the document. The document is then emitted to this adaptor's children

func (*Transformer) SampleConfig

func (t *Transformer) SampleConfig() string

SampleConfig for transformer adaptor

func (*Transformer) Start

func (t *Transformer) Start() error

Start the adaptor as a source (not implemented for this adaptor)

func (*Transformer) Stop

func (t *Transformer) Stop() error

Stop the adaptor

Jump to

Keyboard shortcuts

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