stringmap

package
v0.25.2 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package stringmap provides a read-only, deterministically-ordered view over a set of string key/value pairs. It is the type the SDK hands back to users for things like incoming request headers and TerminalError metadata, where exposing a plain map would leak Go's intentionally-randomized map iteration order.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map interface {
	// Get returns the value associated with key, or "" if there is none.
	Get(key string) string
	// Iter iterates the pairs in a deterministic, key-sorted order.
	Iter() iter.Seq2[string, string]
	// ToMap returns the pairs as a new plain map, for interop with external code.
	// The returned map is a copy: mutating it does not affect the Map.
	ToMap() map[string]string

	json.Marshaler
}

Map is a read-only view over string key/value pairs with deterministic (key-sorted) iteration order.

func New

func New(m map[string]string) Map

New wraps m as a read-only Map. The map must not be mutated afterwards; callers of the returned Map cannot mutate m, as ToMap returns a copy.

Jump to

Keyboard shortcuts

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