filter

package
v0.0.0-...-7faa966 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Runner lets us mock exec.Command for testing
	Runner = exec.Command
	// ErrUnknownFilter indicates the type of filter is not recognized
	ErrUnknownFilter = fmt.Errorf("unknown filter type")
)

Functions

This section is empty.

Types

type Filter

type Filter struct {
	Type     string `json:"type"`
	Filterer `json:"-"`
}

Filter is an individual filter

func (*Filter) MarshalJSON

func (f *Filter) MarshalJSON() ([]byte, error)

MarshalJSON encodes our Filterer as `filter`

func (*Filter) UnmarshalJSON

func (f *Filter) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals our Filterer interface to a struct

type Filterer

type Filterer interface {
	StripUnsafe() error
	Run(bdy []byte) (out interface{}, err error)
}

Filterer outlines methods to filter data

type JMESPath

type JMESPath struct {
	Expression string `json:"expression"`
}

JMESPath is a JMESPath filter

func (*JMESPath) Run

func (j *JMESPath) Run(bdy []byte) (out interface{}, err error)

Run applies a JMESPath filter

func (*JMESPath) StripUnsafe

func (j *JMESPath) StripUnsafe() error

StripUnsafe removes unsafe characters to prevent cli injection

type Xidel

type Xidel struct {
	Expression string `json:"expression"`
}

Xidel is a filter that is used by XPath

Jump to

Keyboard shortcuts

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