filter

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2019 License: BSD-3-Clause Imports: 4 Imported by: 0

README


title: Filter weight: 4603

Filter

This activity allows you to filter out data in a streaming pipeline, can also be used in flows.

Installation

Flogo CLI

flogo install github.com/TIBCOSoftware/flogo-contrib/activity/filter

Schema

Settings, Inputs and Outputs:

{
  "settings": [
    {
      "name": "type",
      "type": "string",
      "required": true,
      "allowed" : ["non-zero"]
    },
    {
      "name": "proceedOnlyOnEmit",
      "type": "boolean"
    }
  ],
  "input":[
    {
      "name": "value",
      "type": "any"
    }
  ],
  "output": [
    {
      "name": "filtered",
      "type": "boolean"
    },
    {
      "name": "value",
      "type": "any"
    }
  ]
}

Settings

Setting Required Description
type True The type of filter to apply [ex. non-zero]
proceedOnlyOnEmit False Indicates that the next activity should proceed, should always be set to false when used in a flow

Outputs

Value Description
filtered Indicates if the value was filtered out
value The input value, it is 0 if it was filtered out

Example

The example below filters out all zero 'movement' readings

{
  "id": "filter1",
  "name": "Filter",
  "activity": {
    "ref": "github.com/TIBCOSoftware/flogo-contrib/activity/filter",
    "settings": {
      "type": "non-zero"
    },
    "mappings": {
      "input": [
        {
          "type": "assign",
          "value": "movement",
          "mapTo": "value"
        }
      ]
    }
  }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNonZero

func IsNonZero(val interface{}) bool

func New

func New(config *activity.Config) (activity.Activity, error)

func NewActivity

func NewActivity(md *activity.Metadata) activity.Activity

NewActivity creates a new AppActivity

Types

type Filter

type Filter interface {
	FilterOut(val interface{}) bool
}

type FilterActivity

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

FilterActivity is an Activity that is used to Filter a message to the console

func (*FilterActivity) Eval

func (a *FilterActivity) Eval(ctx activity.Context) (done bool, err error)

Eval implements api.Activity.Eval - Filters the Message

func (*FilterActivity) Metadata

func (a *FilterActivity) Metadata() *activity.Metadata

Metadata returns the activity's metadata

type NonZeroFilter

type NonZeroFilter struct {
}

func (*NonZeroFilter) FilterOut

func (*NonZeroFilter) FilterOut(val interface{}) bool

type Settings

type Settings struct {
	Type              string `md:"required,allowed(non-zero)"`
	ProceedOnlyOnEmit bool
}

we can generate json from this! - we could also create a "validate-able" object from this

Jump to

Keyboard shortcuts

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