mapperkit

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 13 Imported by: 0

README

mapperkit

Go Reference Go Report Card CI

mapperkit is a small, fast template engine for turning raw events (TSV lines, JSON, XML, HTTP headers, cookies and query parameters) into clean JSON documents or plain strings, driven by configuration rather than code.

{"user":"{{data.user.name.toUpper()}}","age":"{{data.user.age.toInt()}}"}
        +  {"user":{"name":"alice","age":"42"}}
        =  {"user":"ALICE","age":42}

Write the mapping once as a template, store it next to the rest of your configuration, and let non-Go people change it without a redeploy.

Features

  • One syntax for every input: positional fields (data[3]), JSON paths (data.a.b[0], powered by gjson), XML paths with indexes, predicates and attributes (data.param[key=ID].value, data.@version), header["…"], cookie["…"], query["…"], plus flow_id, timestamp and uuid.
  • Chainable methods: dates (format, toUnix, unixFormat), numbers (toInt, hexToInt), booleans (toBool), strings (trim, toLower, toUpper, replace, substr), URLs (host).
  • Conditionals: {{#if}} / {{#else if}} / {{#else}} / {{/if}} with == != > < >= <= in.
  • Always-valid JSON: values inside JSON strings are escaped automatically; integer and boolean results render as real JSON numbers/booleans.
  • Compile once, execute many: compiled templates are immutable and safe for concurrent use; the single-placeholder fast path allocates nothing.
  • Validation helpers for config UIs and APIs: Canonicalize and ValidateRef.
  • Two small dependencies (gjson, google/uuid), no reflection, no text/template.

Install

go get github.com/boostgo/mapperkit

Requires Go 1.23 or newer.

Quick start

package main

import (
	"fmt"
	"log"

	"github.com/boostgo/mapperkit"
)

func main() {
	tmpl, err := mapperkit.Compile(`{
	  "id": "{{flow_id}}:{{data.order.id}}",
	  "email": "{{data.order.email.toLower()}}",
	  "total": "{{data.order.total.toInt()}}",
	  "paid": "{{data.order.paid.toBool()}}"
	}`)
	if err != nil {
		log.Fatal(err)
	}

	out, err := tmpl.Execute(mapperkit.Context{
		FlowId:  "orders",
		RawJSON: []byte(`{"order":{"id":"A-17","email":"Alice@Example.COM","total":"149.90","paid":"1"}}`),
	})
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(string(out))
	// {"id":"orders:A-17","email":"alice@example.com","total":149,"paid":true}
}

Examples

TSV / positional fields
tmpl, _ := mapperkit.Compile(`{"id":"{{data[0]}}","host":"{{data[2].host()}}","ok":"{{data[1].toBool()}}"}`)

out, _ := tmpl.Execute(mapperkit.Context{
	RawFields: []string{"evt-1", "1", "https://example.com:8443/path"},
})
// {"id":"evt-1","host":"example.com","ok":true}

An out-of-range index resolves to an empty string, never panics.

XML

Namespace prefixes are ignored, and the root element may be included or omitted.

tmpl, _ := mapperkit.Compile(`{"phone":"{{data.phone}}","service":"{{data.params.param[key=SERVICE].value}}"}`)

xml := []byte(`<ns:event xmlns:ns="urn:x">
  <ns:phone>15550001234</ns:phone>
  <ns:params><ns:param><ns:key>SERVICE</ns:key><ns:value>42</ns:value></ns:param></ns:params>
</ns:event>`)

out, _ := tmpl.Execute(mapperkit.Context{RawXML: xml})
// {"phone":"15550001234","service":"42"}
Path Meaning
a.b text of <b> inside <a>
item[1].name the second <item> (0-based)
param[key=ID].value the <param> whose child <key> has text ID
node.@id attribute id of <node>

When several templates are evaluated against one XML event, parse it once:

ctx := mapperkit.Context{RawXML: raw}.WithParsedXML()
Conditionals
tmpl, _ := mapperkit.Compile(
	`{"level":{{#if data.code >= 500}}"error"{{#else if data.code >= 400}}"warn"{{#else}}"info"{{/if}}}`)

Comparisons are numeric when both sides parse as numbers and lexicographic otherwise. in matches against a list: {{#if data.kind in ["a", "b"]}}…{{/if}}.

Strings and keys

CompileString produces plain strings (no JSON escaping), which is ideal for message keys, cache keys and identifiers:

key, _ := mapperkit.CompileString(`{{flow_id}}:{{header["X-Tenant"]}}:{{data[0].substr(0, 3)}}`)
s, _ := key.Execute(mapperkit.Context{
	FlowId:    "orders",
	Headers:   map[string]string{"X-Tenant": "acme"},
	RawFields: []string{"ABCDEF"},
})
// orders:acme:ABC
JSON safety

A placeholder inside a JSON string literal is escaped, so any value produces valid JSON:

tmpl, _ := mapperkit.Compile(`{"text":"{{data[0]}}"}`)
out, _ := tmpl.Execute(mapperkit.Context{RawFields: []string{"line 1\nsaid \"hi\""}})
// {"text":"line 1\nsaid \"hi\""}

If a placeholder is the whole content of a JSON string and its last method is toInt, toUnix, hexToInt or toBool, the quotes are dropped and the value becomes a JSON number or boolean. A placeholder outside quotes is inserted as is, so you can embed a nested JSON object: {"payload":{{data.payload}}}.

Validating user-supplied references
// "4" -> "{{data[4]}}", "user.name" -> "{{data.user.name}}"
ref, _ := mapperkit.Canonicalize(input)

if err := mapperkit.ValidateRef(mapperkit.ModeSingleRef, mapperkit.FormatTSV, ref); err != nil {
	// errors.Is(err, mapperkit.ErrPathBaseOnIndexFormat), ErrNotSingleRef, ...
}
Mode Allows
ModeSingleRef exactly one placeholder (or a plain literal)
ModeStringTemplate literals and placeholders, no {{#if}}
ModeFullTemplate everything

Runnable programs live in examples/: json, tsv and xml (go run ./examples/json).

Reference

Placeholders
Placeholder Source
{{data[N]}} Context.RawFields[N]
{{data.path}} Context.RawJSON (gjson path; a[0] is accepted) or, if empty, Context.RawXML
{{header["name"]}} Context.Headers
{{cookie["name"]}} Context.Cookies
{{query["name"]}} Context.QueryParams
{{flow_id}} Context.FlowId
{{timestamp}} current Unix time, seconds
{{uuid}} random UUID v4
Methods

Up to five methods can be chained; each one receives the result of the previous one. String arguments use single quotes.

Method Result Renders as
.format('2006-01-02') date reformatted with a Go layout (unchanged if not a date) string
.toUnix() date → Unix seconds (unchanged if not a date) number
.unixFormat('layout') Unix seconds → UTC date; default layout 2006-01-02 15:04:05 string
.toInt() integer; floats truncated; anything else 0 number
.hexToInt() hex (optional 0x) → decimal; invalid 0 number
.toBool() true/false (case-insensitive) or number ≥ 1 → true; else false boolean
.toLower(), .toUpper(), .trim() case / whitespace string
.replace('old', 'new') replace all occurrences string
.substr(from), .substr(from, len) rune-based substring; negative from counts from the end string
.host() strip scheme, path and port from a URL string

Recognized date formats: RFC 3339, 2006-01-02T15:04:05, 2006-01-02 15:04:05, 2006-01-02, 02.01.2006[ 15:04:05], 01/02/2006[ 15:04:05], RFC 1123, RFC 822 and Unix seconds. Dates without a zone are parsed in time.Local.

Errors

All errors wrap a sentinel (ErrCompile, ErrUnclosedPlaceholder, ErrUnknownPlaceholder, ErrUnknownMethod, ErrIfBlockSyntax, ErrTooManyMethods, ErrInvalidMethodArg, …), so use errors.Is. See the package documentation for the full list.

Versioning

mapperkit.Version() returns the engine version. Services that validate templates in one place and execute them in another can compare it to make sure both run the same semantics.

Contributing

Issues and pull requests are welcome. Before sending a PR:

make test   # go vet + go test -race
make lint   # golangci-lint
make cover  # coverage report

Please add a test (and, for user-visible behavior, an Example) for every change, and update CHANGELOG.md.

License

MIT © 2026 boostgo

Documentation

Overview

Package mapperkit is a small, fast template engine that maps raw events (TSV fields, JSON, XML, HTTP headers/cookies/query parameters) into JSON documents or plain strings.

Templates are compiled once and executed many times; execution is safe for concurrent use.

Placeholders

{{data[N]}}             N-th positional field (Context.RawFields), "" if out of range
{{data.path}}           JSON path (gjson syntax, a[0] is accepted as a.0) or, without JSON,
                        an XML path: "a.b", "item[0].x", "param[key=ID].value", "node.@attr";
                        namespace prefixes are ignored and the root element may be omitted
{{header["name"]}}      Context.Headers
{{cookie["name"]}}      Context.Cookies
{{query["name"]}}       Context.QueryParams
{{flow_id}}             Context.FlowId
{{timestamp}}           current Unix time in seconds
{{uuid}}                a random UUID v4

Methods

Methods are chained left to right (at most 5 per placeholder):

.format('2006-01-02')     parse a date and reformat it with a Go layout
.toUnix()                 parse a date and return Unix seconds (rendered as a JSON number)
.unixFormat('layout')     Unix seconds -> formatted UTC date (default "2006-01-02 15:04:05")
.toInt()                  integer (floats are truncated, garbage is 0; JSON number)
.hexToInt()               hex string (optional 0x) -> decimal (JSON number)
.toBool()                 "true"/"false"/number >= 1 -> boolean (JSON boolean)
.toLower() .toUpper() .trim()
.replace('old', 'new')    replace all occurrences
.substr(from[, len])      rune-based substring; negative from counts from the end
.host()                   strip scheme, path and port from a URL

Dates are recognized in RFC 3339, "2006-01-02T15:04:05", "2006-01-02 15:04:05", "2006-01-02", "02.01.2006[ 15:04:05]", "01/02/2006[ 15:04:05]", RFC 1123, RFC 822 and as Unix seconds.

Conditionals

{{#if data.status == "ok"}}...{{#else if data.code >= 500}}...{{#else}}...{{/if}}

Operators: ==, !=, >, <, >=, <= (numeric when both sides are numbers, lexicographic otherwise) and in, e.g. data.kind in ["a", "b"].

JSON output

Compile treats the template as text, not as JSON, but understands JSON strings:

  • a placeholder inside a JSON string literal is escaped, so values with quotes, backslashes or control characters always produce valid JSON;
  • a placeholder that is the whole content of a JSON string and ends with toInt, toUnix, hexToInt or toBool loses its quotes and renders as a bare number or boolean;
  • a placeholder outside quotes is inserted as is (e.g. a nested JSON object).

CompileString never escapes: use it for keys and other non-JSON strings.

Validation helpers

Canonicalize turns short-hand references ("4", "[4]", "a.b") into placeholders, and ValidateRef checks a value against a RefMode and a SourceFormat before it is stored.

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	// ErrCompile wraps every error returned by Compile.
	ErrCompile = errors.New("mapperkit.compile")
	// ErrUnclosedPlaceholder means a "{{" has no matching "}}".
	ErrUnclosedPlaceholder = errors.New("mapperkit.unclosed_placeholder")
	// ErrInvalidDataIndex means the N in data[N] is not an integer (or is negative in ValidateRef).
	ErrInvalidDataIndex = errors.New("mapperkit.invalid_data_index")
	// ErrUnknownPlaceholder means the placeholder base is not one of data[N], data.path,
	// header["k"], cookie["k"], query["k"], flow_id, timestamp or uuid.
	ErrUnknownPlaceholder = errors.New("mapperkit.unknown_placeholder")
	// ErrUnknownMethod means a chained method name is not supported.
	ErrUnknownMethod = errors.New("mapperkit.unknown_method")
	// ErrResolve means a placeholder could not be resolved at execution time.
	ErrResolve = errors.New("mapperkit.resolve")
	// ErrParseDate means a value could not be parsed as a date.
	ErrParseDate = errors.New("mapperkit.parse_date")
	// ErrInvalidIfCondition means a {{#if}} condition has no operator or a malformed operand.
	ErrInvalidIfCondition = errors.New("mapperkit.invalid_if_condition")
	// ErrUnclosedIfBlock means a {{#if}} block has no matching {{/if}}.
	ErrUnclosedIfBlock = errors.New("mapperkit.unclosed_if_block")
	// ErrIfBlockSyntax means a structural error in an {{#if}} block (stray {{#else}} or {{/if}}, etc.).
	ErrIfBlockSyntax = errors.New("mapperkit.if_block_syntax")
	// ErrTooManyMethods means a placeholder chains more methods than allowed.
	ErrTooManyMethods = errors.New("mapperkit.too_many_methods")
	// ErrInvalidMethodArg means a method argument is malformed (e.g. a non-integer substr offset).
	ErrInvalidMethodArg = errors.New("mapperkit.invalid_method_arg")

	// ErrNotSingleRef is returned by ValidateRef in ModeSingleRef when s is not exactly one placeholder.
	ErrNotSingleRef = errors.New("mapperkit.not_single_ref")
	// ErrIfBlockNotAllowed is returned by ValidateRef in ModeStringTemplate when s contains {{#if}}.
	ErrIfBlockNotAllowed = errors.New("mapperkit.if_block_not_allowed")
	// ErrIndexBaseOnPathFormat is returned by ValidateRef when data[N] is used for a JSON or XML source.
	ErrIndexBaseOnPathFormat = errors.New("mapperkit.index_base_on_path_format")
	// ErrPathBaseOnIndexFormat is returned by ValidateRef when data.path is used for a TSV source.
	ErrPathBaseOnIndexFormat = errors.New("mapperkit.path_base_on_index_format")
	// ErrDataBaseOnTextFormat is returned by ValidateRef when any data reference is used for a text source.
	ErrDataBaseOnTextFormat = errors.New("mapperkit.data_base_on_text_format")
)

Sentinel errors. Errors returned by Compile, CompileString, Execute and ValidateRef wrap one of these, so callers can match them with errors.Is.

Functions

func Canonicalize

func Canonicalize(raw string) (canonical string, changed bool)

Canonicalize rewrites a short-hand field reference into its canonical placeholder form without changing its meaning. changed is true if the value was rewritten. Rules, in order:

"" or "none"         -> unchanged
contains "{{"        -> unchanged (already a template)
"4"                  -> "{{data[4]}}"
"[4]"                -> "{{data[4]}}"
"data[4]"            -> "{{data[4]}}"
anything else (path) -> "{{data.<path>}}"

The last rule adds the "data." prefix mechanically, without heuristics: "data.phone" becomes "{{data.data.phone}}" on purpose. Whether the base fits the source is checked by ValidateRef, not by Canonicalize.

Example
package main

import (
	"fmt"

	"github.com/boostgo/mapperkit"
)

func main() {
	for _, raw := range []string{"4", "[4]", "user.name", "{{data[1]}}"} {
		c, changed := mapperkit.Canonicalize(raw)
		fmt.Println(c, changed)
	}
}
Output:
{{data[4]}} true
{{data[4]}} true
{{data.user.name}} true
{{data[1]}} false
func NavigateXMLTree(tree any, path string) string

NavigateXMLTree resolves a dot-path against a tree returned by ParseXMLTree. Returns an empty string if the path is not found, tree is nil, or wrong type.

func ParseXMLTree

func ParseXMLTree(data []byte) (any, error)

ParseXMLTree parses XML bytes into an opaque tree handle. Pass the result to NavigateXMLTree to extract field values.

func ResolveXMLPosition

func ResolveXMLPosition(tree any, rawXML []byte, position string) string

ResolveXMLPosition resolves a position expression against a pre-parsed XML tree. Position may be a raw path ("phone") or a template expression ("{{data.phone}}"). rawXML is only used when position contains template placeholders.

func ValidateRef

func ValidateRef(mode RefMode, format SourceFormat, s string) error

ValidateRef checks that s is allowed in a field with the given mode for a source of the given format. It returns nil for an empty string and for the keyword "none": deciding whether a field must be configured is up to the caller.

Checks run in order and the first problem is returned:

  1. s compiles (balanced braces, known bases and methods, method chain length, substr args);
  2. ModeSingleRef: exactly one placeholder and no surrounding text (ErrNotSingleRef);
  3. ModeStringTemplate: no {{#if}} blocks (ErrIfBlockNotAllowed);
  4. the placeholder base matches format (ErrIndexBaseOnPathFormat, ErrPathBaseOnIndexFormat, ErrDataBaseOnTextFormat); skipped for FormatUnknown;
  5. no negative data[N] index (ErrInvalidDataIndex).
Example
package main

import (
	"errors"
	"fmt"

	"github.com/boostgo/mapperkit"
)

func main() {
	err := mapperkit.ValidateRef(mapperkit.ModeSingleRef, mapperkit.FormatTSV, "{{data.user}}")
	fmt.Println(errors.Is(err, mapperkit.ErrPathBaseOnIndexFormat))

	err = mapperkit.ValidateRef(mapperkit.ModeStringTemplate, mapperkit.FormatJSON, "id-{{data.id}}")
	fmt.Println(err)
}
Output:
true
<nil>

func Version

func Version() string

Version returns the template engine version. It is bumped together with the git tag on every release.

Types

type CompiledString

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

CompiledString is a compiled single string template (for key templates etc.).

func CompileString

func CompileString(template string) (*CompiledString, error)

CompileString parses a single string template with {{...}} placeholders. Returns nil if template is empty.

Example
package main

import (
	"fmt"

	"github.com/boostgo/mapperkit"
)

func main() {
	key, _ := mapperkit.CompileString(`{{flow_id}}:{{header["X-Tenant"]}}:{{data[0].substr(0, 3)}}`)

	s, _ := key.Execute(mapperkit.Context{
		FlowId:    "orders",
		Headers:   map[string]string{"X-Tenant": "acme"},
		RawFields: []string{"ABCDEF"},
	})

	fmt.Println(s)
}
Output:
orders:acme:ABC

func (*CompiledString) Execute

func (t *CompiledString) Execute(ctx Context) (string, error)

Execute resolves the compiled string template with the given context.

type CompiledTemplate

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

CompiledTemplate is a whole output template (usually JSON) parsed as a text template. Placeholders {{...}} are resolved and the result should be valid JSON. This supports unquoted placeholders for int/bool values.

func Compile

func Compile(templateStr string) (*CompiledTemplate, error)

Compile parses an output template as a text template with {{...}} placeholders. The template is NOT parsed as JSON — placeholders can appear unquoted for int/bool values. Returns nil if template is empty (passthrough mode).

Example (Conditional)
package main

import (
	"fmt"

	"github.com/boostgo/mapperkit"
)

func main() {
	tmpl, _ := mapperkit.Compile(
		`{"level":{{#if data.code >= 500}}"error"{{#else if data.code >= 400}}"warn"{{#else}}"info"{{/if}}}`)

	for _, code := range []string{"503", "404", "200"} {
		out, _ := tmpl.Execute(mapperkit.Context{RawJSON: []byte(`{"code":` + code + `}`)})
		fmt.Println(string(out))
	}
}
Output:
{"level":"error"}
{"level":"warn"}
{"level":"info"}
Example (Escaping)
package main

import (
	"fmt"

	"github.com/boostgo/mapperkit"
)

func main() {
	tmpl, _ := mapperkit.Compile(`{"text":"{{data[0]}}"}`)

	out, _ := tmpl.Execute(mapperkit.Context{RawFields: []string{"line 1\nsaid \"hi\""}})

	fmt.Println(string(out))
}
Output:
{"text":"line 1\nsaid \"hi\""}
Example (Json)
package main

import (
	"fmt"

	"github.com/boostgo/mapperkit"
)

func main() {
	tmpl, err := mapperkit.Compile(`{"user":"{{data.user.name.toUpper()}}","age":"{{data.user.age.toInt()}}"}`)
	if err != nil {
		panic(err)
	}

	out, err := tmpl.Execute(mapperkit.Context{
		RawJSON: []byte(`{"user":{"name":"alice","age":"42"}}`),
	})
	if err != nil {
		panic(err)
	}

	fmt.Println(string(out))
}
Output:
{"user":"ALICE","age":42}
Example (Tsv)
package main

import (
	"fmt"

	"github.com/boostgo/mapperkit"
)

func main() {
	tmpl, _ := mapperkit.Compile(`{"id":"{{data[0]}}","host":"{{data[2].host()}}","ok":"{{data[1].toBool()}}"}`)

	out, _ := tmpl.Execute(mapperkit.Context{
		RawFields: []string{"evt-1", "1", "https://example.com:8443/path"},
	})

	fmt.Println(string(out))
}
Output:
{"id":"evt-1","host":"example.com","ok":true}
Example (Xml)
package main

import (
	"fmt"

	"github.com/boostgo/mapperkit"
)

func main() {
	tmpl, _ := mapperkit.Compile(`{"phone":"{{data.phone}}","service":"{{data.params.param[key=SERVICE].value}}"}`)

	xml := []byte(`<ns:event xmlns:ns="urn:x">
  <ns:phone>15550001234</ns:phone>
  <ns:params>
    <ns:param><ns:key>SERVICE</ns:key><ns:value>42</ns:value></ns:param>
  </ns:params>
</ns:event>`)

	out, _ := tmpl.Execute(mapperkit.Context{RawXML: xml})

	fmt.Println(string(out))
}
Output:
{"phone":"15550001234","service":"42"}

func (*CompiledTemplate) Execute

func (t *CompiledTemplate) Execute(ctx Context) ([]byte, error)

Execute resolves all placeholders and returns the result as bytes.

type Context

type Context struct {
	// FlowId is the value of the {{flow_id}} placeholder (any caller-defined identifier
	// of the pipeline, stream or tenant that produced the event).
	FlowId string //nolint:revive // kept for API compatibility
	// RawFields are the positional fields of a TSV/CSV-like event, read by {{data[N]}}.
	RawFields []string
	// RawJSON is a JSON event, read by {{data.path}} (gjson syntax; a[0] is also accepted).
	RawJSON []byte
	// RawXML is an XML event, read by {{data.path}} when RawJSON is empty.
	RawXML []byte
	// Headers are read by {{header["name"]}}.
	Headers map[string]string
	// Cookies are read by {{cookie["name"]}}.
	Cookies map[string]string
	// QueryParams are read by {{query["name"]}}.
	QueryParams map[string]string
	// contains filtered or unexported fields
}

Context is the input a template is executed against. Set only the fields your templates use; a placeholder whose source is empty resolves to "".

func (Context) WithParsedXML

func (ctx Context) WithParsedXML() Context

WithParsedXML parses RawXML once and returns a Context that can be reused across many Execute calls. Context is passed by value, so without this every Execute parses the XML again; a caller that evaluates several templates against the same event should call WithParsedXML once and pass the result to all of them.

Example
package main

import (
	"fmt"

	"github.com/boostgo/mapperkit"
)

func main() {
	ctx := mapperkit.Context{RawXML: []byte(`<e><a>1</a><b>2</b></e>`)}.WithParsedXML()

	a, _ := mapperkit.CompileString("{{data.a}}")
	b, _ := mapperkit.CompileString("{{data.b}}")

	va, _ := a.Execute(ctx) // the XML is parsed only once
	vb, _ := b.Execute(ctx)
	fmt.Println(va, vb)
}
Output:
1 2

type RefMode

type RefMode int

RefMode describes how much freedom a configuration field allows in its value.

const (
	// ModeSingleRef allows exactly one placeholder and nothing around it, e.g.
	// "{{data[4]}}" or "{{data.content.phone.trim()}}". A plain literal without "{{" is
	// also accepted. Typical use: a field reference or the left side of a condition.
	ModeSingleRef RefMode = iota
	// ModeStringTemplate allows literals plus any number of placeholders, but no {{#if}}
	// blocks, e.g. "{{data[5]}}-{{data[6]}}" or "evt:{{flow_id}}:{{data.id}}". Typical use:
	// keys, deduplication keys, composite identifiers.
	ModeStringTemplate
	// ModeFullTemplate allows everything, including {{#if}} blocks. Typical use: a full
	// JSON output template.
	ModeFullTemplate
)

type SourceFormat

type SourceFormat string

SourceFormat is the message format of a data source; it decides which placeholder base (data[N] or data.path) is valid. FormatUnknown disables the base check (useful when the caller does not know the format yet).

const (
	// FormatUnknown disables the source format check in ValidateRef.
	FormatUnknown SourceFormat = ""
	// FormatTSV is a tab-separated (positional) source: use {{data[N]}}.
	FormatTSV SourceFormat = "tsv"
	// FormatJSON is a JSON source: use {{data.path}}.
	FormatJSON SourceFormat = "json"
	// FormatXML is an XML source: use {{data.path}}.
	FormatXML SourceFormat = "xml"
	// FormatText is a plain-text source: data references are not supported.
	FormatText SourceFormat = "text"
)

Directories

Path Synopsis
examples
json command
Command json maps an incoming JSON event into a normalized JSON document.
Command json maps an incoming JSON event into a normalized JSON document.
tsv command
Command tsv maps tab-separated log lines into JSON and builds a key for each line.
Command tsv maps tab-separated log lines into JSON and builds a key for each line.
xml command
Command xml maps an XML notification (with namespaces, attributes and repeated elements) into JSON.
Command xml maps an XML notification (with namespaces, attributes and repeated elements) into JSON.

Jump to

Keyboard shortcuts

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