Documentation
¶
Index ¶
- Constants
- func Byte(ctx context.Context, byters []Byter, data []byte) ([]byte, error)
- func Channel(ctx context.Context, channelers []Channeler, ch <-chan []byte) (<-chan []byte, error)
- func ReadOnlyChannel(ch chan []byte) <-chan []byte
- type Byter
- type Capture
- type CaptureOptions
- type Case
- type CaseOptions
- type Channeler
- type Concat
- type ConcatOptions
- type Config
- type Convert
- type ConvertOptions
- type Copy
- type Count
- type Delete
- type Domain
- type DomainOptions
- type Drop
- type DynamoDB
- type DynamoDBInput
- type DynamoDBOptions
- type Expand
- type ExpandOptions
- type Flatten
- type FlattenOptions
- type Hash
- type HashOptions
- type Input
- type Inputs
- type Insert
- type InsertOptions
- type Lambda
- type LambdaInput
- type LambdaOptions
- type Math
- type MathOptions
- type Output
- type Replace
- type ReplaceOptions
- type Time
- type TimeOptions
- type Zip
- type ZipOptions
Constants ¶
const ByteInvalidFactoryConfig = errors.Error("ByteInvalidFactoryConfig")
ByteInvalidFactoryConfig is used when an unsupported Byte is referenced in ByteFactory
const ChannelInvalidFactoryConfig = errors.Error("ChannelInvalidFactoryConfig")
ChannelInvalidFactoryConfig is used when an unsupported Channel is referenced in ChannelFactory
const DomainNoSubdomain = errors.Error("DomainNoSubdomain")
DomainNoSubdomain is used when a domain without a subdomain is processed
Variables ¶
This section is empty.
Functions ¶
func Channel ¶
Channel accepts a channel of bytes and applies all processors to data in the channel.
func ReadOnlyChannel ¶
ReadOnlyChannel turns a write/read channel into a read-only channel.
Types ¶
type Byter ¶
Byter is an interface for applying processors to bytes.
func ByterFactory ¶
ByterFactory loads a Byter from a Config. This is the recommended function for retrieving ready-to-use Byters.
func MakeAllByters ¶
MakeAllByters accepts an array of Config and returns populated Byters. This a conveience function for loading many Byters.
type Capture ¶
type Capture struct {
Condition condition.OperatorConfig `mapstructure:"condition"`
Input Input `mapstructure:"input"`
Output Output `mapstructure:"output"`
Options CaptureOptions `mapstructure:"options"`
}
Capture implements the Byter and Channeler interfaces and applies a capturing regular expression to data. More information is available in the README.
type CaptureOptions ¶
type CaptureOptions struct {
Expression string `mapstructure:"expression"`
Count int `mapstructure:"count"`
}
CaptureOptions contain custom options settings for this processor.
Expression: the capturing regular expression Count (optional): the number of captures to return; defaults to 0, which returns all captures
type Case ¶
type Case struct {
Condition condition.OperatorConfig `mapstructure:"condition"`
Input Input `mapstructure:"input"`
Output Output `mapstructure:"output"`
Options CaseOptions `mapstructure:"options"`
}
Case implements the Byter and Channeler interfaces and converts the case of a string. More information is available in the README.
type CaseOptions ¶
type CaseOptions struct {
Case string `mapstructure:"case"`
}
CaseOptions contain custom options settings for this processor.
Case: the case to convert the string to; one of: upper, lower, or snake
type Channeler ¶
Channeler is an interface for applying processors to channels of bytes.
func ChannelerFactory ¶
ChannelerFactory loads Channeler from a Config. This is the recommended function for retrieving ready-to-use Channelers.
func MakeAllChannelers ¶
MakeAllChannelers accepts an array of Config and returns populated Channelers. This a conveience function for loading many Channelers.
type Concat ¶
type Concat struct {
Condition condition.OperatorConfig `mapstructure:"condition"`
Input Inputs `mapstructure:"input"`
Output Output `mapstructure:"output"`
Options ConcatOptions `mapstructure:"options"`
}
Concat implements the Byter and Channeler interfaces and concatenates multiple JSON keys into a single value with a separator character. More information is available in the README.
type ConcatOptions ¶
type ConcatOptions struct {
Separator string `mapstructure:"separator"`
}
ConcatOptions contain custom options settings for this processor.
Separator: the string that separates the concatenated values.
type Convert ¶
type Convert struct {
Condition condition.OperatorConfig `mapstructure:"condition"`
Input Input `mapstructure:"input"`
Output Output `mapstructure:"output"`
Options ConvertOptions `mapstructure:"options"`
}
Convert implements the Byter and Channeler interfaces and converts values between types. More information is available in the README.
type ConvertOptions ¶
type ConvertOptions struct {
Type string `mapstructure:"type"`
}
ConvertOptions contain custom options settings for this processor.
Type: the type that the value should be converted to; one of: bool (boolean), int (integer), float, uint (unsigned integer), string
type Copy ¶
type Copy struct {
Condition condition.OperatorConfig `mapstructure:"condition"`
Input Input `mapstructure:"input"`
Output Output `mapstructure:"output"`
}
Copy implements the Byter and Channeler interfaces and copies values between JSON keys, preserving the original JSON key. More information is available in the README.
type Count ¶
type Count struct{}
Count implements the Channeler interfaces and counts all data put into the channel. More information is available in the README.
type Delete ¶
type Delete struct {
Condition condition.OperatorConfig `mapstructure:"condition"`
Input Input `mapstructure:"input"`
}
Delete implements the Byter and Channeler interfaces and deletes JSON keys. More information is available in the README.
type Domain ¶
type Domain struct {
Condition condition.OperatorConfig `mapstructure:"condition"`
Input Input `mapstructure:"input"`
Output Output `mapstructure:"output"`
Options DomainOptions `mapstructure:"options"`
}
Domain implements the Byter and Channeler interfaces and parses fully qualified domain names into separate labels. More information is available in the README.
type DomainOptions ¶
type DomainOptions struct {
Function string `mapstructure:"function"`
}
DomainOptions contain custom options settings for this processor.
Function: the domain processing function to apply to the data; one of: tld, domain, or subdomain
type Drop ¶
type Drop struct {
Condition condition.OperatorConfig `mapstructure:"condition"`
}
Drop implements the Channeler interface and drops any matched data. More information is available in the README.
type DynamoDB ¶
type DynamoDB struct {
Condition condition.OperatorConfig `mapstructure:"condition"`
Input DynamoDBInput `mapstructure:"input"`
Output Output `mapstructure:"output"`
Options DynamoDBOptions `mapstructure:"options"`
}
DynamoDB implements the Byter and Channeler interfaces and queries DynamoDB and returns all matched items as an array of JSON objects. More information is available in the README.
type DynamoDBInput ¶
type DynamoDBInput struct {
PartitionKey string `mapstructure:"partition_key"`
SortKey string `mapstructure:"sort_key"`
}
DynamoDBInput contains custom input settings for this processor.
PartitionKey: the JSON key that is used as the paritition key value for the DynamoDB query SortKey (optional): the JSON key that is used as the sort /range key value for the DynamoDB query
type DynamoDBOptions ¶
type DynamoDBOptions struct {
Table string `mapstructure:"table"`
KeyConditionExpression string `mapstructure:"key_condition_expression"`
Limit int64 `mapstructure:"limit"`
ScanIndexForward bool `mapstructure:"scan_index_forward"`
}
DynamoDBOptions contain custom options settings for this processor. Refer to the DynamoDB API query documentation for more information: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html.
A common use for this processor is to return the most recent item from a DynamoDB table based on partition and sort keys. This can be achieved by setting Limit to 1 and ScanIndexForward to false.
Table: the DynamoDB table to query KeyConditionExpression: the DynamoDB key condition expression Limit (optional): the number of result items to return ScanIndexForward (optional): reverses the order of item results
type Expand ¶
type Expand struct {
Condition condition.OperatorConfig `mapstructure:"condition"`
Input Input `mapstructure:"input"`
Options ExpandOptions `mapstructure:"options"`
}
Expand implements the Channeler interface and expands data in JSON arrays into individual events. More information is available in the README.
type ExpandOptions ¶
type ExpandOptions struct {
Retain []string `mapstructure:"retain"` // retain fields found anywhere in input
}
ExpandOptions contain custom options settings for this processor.
Retain: array of JSON keys to retain from the original object and insert into the new objects
type Flatten ¶
type Flatten struct {
Condition condition.OperatorConfig `mapstructure:"condition"`
Input Input `mapstructure:"input"`
Output Output `mapstructure:"output"`
Options FlattenOptions `mapstructure:"options"`
}
Flatten implements the Byter and Channeler interfaces and flattens JSON arrays. More information is available in the README.
type FlattenOptions ¶
type FlattenOptions struct {
Deep bool `mapstructure:"deep"`
}
FlattenOptions contain custom options settings for this processor.
Deep: deeply flattens nested arrays.
type Hash ¶
type Hash struct {
Condition condition.OperatorConfig `mapstructure:"condition"`
Input Input `mapstructure:"input"`
Output Output `mapstructure:"output"`
Options HashOptions `mapstructure:"options"`
}
Hash implements the Byter and Channeler interfaces and calculates the hash of data. More information is available in the README.
type HashOptions ¶
type HashOptions struct {
Algorithm string `mapstructure:"algorithm"`
}
HashOptions contain custom options settings for this processor.
Algorithm: the algorithm to apply.
type Input ¶
type Input struct {
Key string `mapstructure:"key"`
}
Input is the default input setting for processors that accept a single JSON key. This can be overriden by each processor.
type Inputs ¶
type Inputs struct {
Keys []string `mapstructure:"keys"`
}
Inputs is the default input setting for processors that accept multiple JSON keys. This can be overriden by each processor.
type Insert ¶
type Insert struct {
Condition condition.OperatorConfig `mapstructure:"condition"`
Output Output `mapstructure:"output"`
Options InsertOptions `mapstructure:"options"`
}
Insert implements the Byter and Channeler interfaces and inserts a value into a JSON object. More information is available in the README.
type InsertOptions ¶
type InsertOptions struct {
Value interface{} `mapstructure:"value"`
}
InsertOptions contain custom options settings for this processor.
Value: the value to insert.
type Lambda ¶
type Lambda struct {
Condition condition.OperatorConfig `mapstructure:"condition"`
Input LambdaInput `mapstructure:"input"`
Output Output `mapstructure:"output"`
Options LambdaOptions `mapstructure:"options"`
}
Lambda implements the Byter and Channeler interfaces and synchronously invokes an AWS Lambda. More information is available in the README.
type LambdaInput ¶
type LambdaInput struct {
Payload []struct {
Key string `mapstructure:"key"`
PayloadKey string `mapstructure:"payload_key"`
} `mapstructure:"payload"`
}
LambdaInput contain custom options settings for this processor.
Payload: maps values from a JSON object (Key) to values in the AWS Lambda payload (PayloadKey)
type LambdaOptions ¶
type LambdaOptions struct {
Function string `mapstructure:"function"`
Errors bool `mapstructure:"errors"`
}
LambdaOptions contain custom options settings for this processor.
Function: the name of the AWS Lambda function to invoke. Errors: if true, then errors from the invoked Lambda will cause this processor to fail (defaults to false).
type Math ¶
type Math struct {
Condition condition.OperatorConfig `mapstructure:"condition"`
Input Inputs `mapstructure:"input"`
Output Output `mapstructure:"output"`
Options MathOptions `mapstructure:"options"`
}
Math implements the Byter and Channeler interfaces and applies mathematical operations to data. More information is available in the README.
type MathOptions ¶
type MathOptions struct {
Operation string `mapstructure:"operation"`
}
MathOptions contain custom options settings for this processor.
Operation: the math operation applied to the data.
type Output ¶
type Output struct {
Key string `mapstructure:"key"`
}
Output is the default output setting for processors that produce a single JSON key. This can be overriden by each processor.
type Replace ¶
type Replace struct {
Condition condition.OperatorConfig `mapstructure:"condition"`
Input Input `mapstructure:"input"`
Output Output `mapstructure:"output"`
Options ReplaceOptions `mapstructure:"options"`
}
Replace implements the Byter and Channeler interfaces and replaces substrings in string values. More information is available in the README.
type ReplaceOptions ¶
type ReplaceOptions struct {
Old string `mapstructure:"old"`
New string `mapstructure:"new"`
Count int `mapstructure:"count"`
}
ReplaceOptions contain custom options settings for this processor.
Old: the substring to replace New: the substring that replaces Count: the number of replacements to make; defaults to 0, which replaces all substrings
type Time ¶
type Time struct {
Condition condition.OperatorConfig `mapstructure:"condition"`
Input Input `mapstructure:"input"`
Output Output `mapstructure:"output"`
Options TimeOptions `mapstructure:"options"`
}
Time implements the Byter and Channeler interfaces and converts time values between formats. More information is available in the README.
type TimeOptions ¶
type TimeOptions struct {
InputFormat string `mapstructure:"input_format"`
InputLocation string `mapstructure:"output_location"`
OutputFormat string `mapstructure:"output_format"`
OutputLocation string `mapstructure:"output_location"`
}
TimeOptions contain custom options settings for this processor.
InputFormat: time format of the input InputLocation (optional): the time zone abbreviation for the input; if empty, then defaults to UTC OutputFormat: time format of the output OutputLocation (optional): the time zone abbreviation for the output; if empty, then defaults to UTC
type Zip ¶
type Zip struct {
Condition condition.OperatorConfig `mapstructure:"condition"`
Input Inputs `mapstructure:"input"`
Output Output `mapstructure:"output"`
Options ZipOptions `mapstructure:"options"`
}
Zip implements the Byter and Channeler interfaces and concatenates JSON arrays into an array of tuples or array of JSON objects. More information is available in the README.
type ZipOptions ¶
type ZipOptions struct {
Keys []string `mapstructure:"keys"`
}
ZipOptions contain custom options settings for this processor.
Keys: location where elements from the input keys are written to; this creates JSON objects (optional)