data

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package data holds the copy, merge and validation helpers shared by the public package and its internal implementations. Everything here works on plain Go values: scalars, slices and string keyed maps.

Index

Constants

View Source
const IsWindows = runtime.GOOS == "windows"

IsWindows reports the host platform. Windows compares environment names case-insensitively.

View Source
const MaxDepth = 32

MaxDepth bounds nesting while validating caller supplied data.

Variables

This section is empty.

Functions

func Clone

func Clone(value any) any

Clone deep copies a copyable data value.

func CloneMap

func CloneMap(in map[string]any) map[string]any

CloneMap deep copies a map of data values.

func CloneStringMap

func CloneStringMap(in map[string]string) map[string]string

CloneStringMap copies a string map.

func CloneStrings

func CloneStrings(in []string) []string

CloneStrings copies a string slice.

func EnvKey

func EnvKey(name string) string

EnvKey normalizes an environment variable name for lookup.

func EnvList

func EnvList(env map[string]string) []string

EnvList flattens an environment map into the KEY=VALUE slice os/exec expects, sorted for deterministic results.

func Merge

func Merge(maps ...map[string]any) map[string]any

Merge returns a new map with later maps overriding earlier ones.

func SortStrings

func SortStrings(values []string)

SortStrings sorts a string slice in place.

func SortedDataKeys

func SortedDataKeys(values map[string]any) []string

SortedDataKeys returns the keys of a data map in ascending order.

func SortedKeys

func SortedKeys(values map[string]string) []string

SortedKeys returns the keys of a string map in ascending order.

func Validate

func Validate(value any, path string) error

Validate accepts only copyable data values: scalars, slices of copyable data and maps with string keys. Functions, channels, pointers, structs with side effects and cyclic data are rejected. The returned error text names the offending path; the caller decides how to classify it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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