mappath

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package mappath provides dotted-path helpers for map[string]any trees. It is the single source of truth for read/write/delete-by-path operations previously duplicated in transform/, provider/env, and providers/consul.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(root map[string]any, parts []string)

Delete removes the leaf at parts; missing paths are silently ignored.

func DeleteDotted

func DeleteDotted(root map[string]any, dotted string)

DeleteDotted is the convenience wrapper for "a.b.c" callers.

func Get

func Get(root map[string]any, parts ...string) (any, bool)

Get returns the value at parts (or root[parts[0]][parts[1]]...) and whether it was found. Intermediate non-map values short-circuit to (nil,false).

func GetDotted

func GetDotted(root map[string]any, dotted string) (any, bool)

GetDotted is the convenience wrapper for "a.b.c" callers.

func Set

func Set(root map[string]any, parts []string, v any)

Set writes v at parts, creating intermediate maps as needed. Existing non-map values along the path are silently overwritten by a fresh map (matches the legacy env/consul behavior).

func SetDotted

func SetDotted(root map[string]any, dotted string, v any)

SetDotted is the convenience wrapper for "a.b.c" callers.

func Split

func Split(dotted string) []string

Split splits a dotted path "a.b.c" into ["a", "b", "c"]. Empty path returns an empty slice (callers may treat that as "root").

Types

This section is empty.

Jump to

Keyboard shortcuts

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