stdlib

package
v0.34.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package stdlib contains Flow-specific standard library functions exposed to River configs.

Index

Constants

This section is empty.

Variables

View Source
var Identifiers = map[string]interface{}{
	"discovery_target_decode": func(in string) (interface{}, error) {
		var targetGroups []*targetgroup.Group
		if err := json.Unmarshal([]byte(in), &targetGroups); err != nil {
			return nil, err
		}

		var res []discovery.Target

		for _, group := range targetGroups {
			for _, target := range group.Targets {

				outputTarget := make(discovery.Target, len(group.Labels)+len(target))
				for k, v := range group.Labels {
					outputTarget[string(k)] = string(v)
				}
				for k, v := range target {
					outputTarget[string(k)] = string(v)
				}

				res = append(res, outputTarget)
			}
		}

		return res, nil
	},
}

Identifiers holds a list of stdlib identifiers by name. All interface{} values are River-compatible values.

Function identifiers are Go functions with exactly one non-error return value, with an optionally supported error return value as the second return value.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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