utils

package
v1.43.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultInterval    = 30 * time.Second
	DefaultMinInterval = 1 * time.Second
)

Variables

This section is empty.

Functions

func AddDataPrefixAndParsePath

func AddDataPrefixAndParsePath(path string) (storage.Path, error)

func InsertFile

func InsertFile(files map[string]any, path []string, document any)

InsertFile inserts given document to the files map by given path

func ParseDuration

func ParseDuration(s string, defaultDuration time.Duration) (time.Duration, error)

func ParseFile

func ParseFile(filename string, r io.Reader) (any, error)

ParseFile decodes json, yaml, yml or xml files

func ParseInterval

func ParseInterval(s string, defaultDuration time.Duration, minDuration time.Duration) (time.Duration, error)

ParseInterval parses the given string into a time.Duration. minDuration ensures that a misconfiguration will not result in excessive polling.

func ParseJSONOrYaml

func ParseJSONOrYaml(r io.Reader) (any, error)

ParseJSONOrYaml decodes a given json or yaml stream to go representation

func ParseXML

func ParseXML(r io.Reader) (ret any, rerr error)

ParseXML decodes a given xml stream to go representation

func ReadTLSConfig

func ReadTLSConfig(insecureSkipVerify bool, certFile, privKeyFile, caCertPath string) (*tls.Config, error)

Types

type Parser

type Parser func(io.Reader) (any, error)

Jump to

Keyboard shortcuts

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