kv

package
v1.16.5 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MPL-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package kv implements core key-value type as a base for labels and annotations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KV

type KV struct {
	// contains filtered or unexported fields
}

KV is a set free-form of key-value pairs.

Order of keys is not guaranteed.

KV support copy-on-write semantics, so metadata copies share common labels as long as possible.

func (*KV) Delete

func (kv *KV) Delete(key string)

Delete the key.

Deleting the key copies the map, so metadata copies share common storage as long as possible.

func (*KV) Do added in v0.3.1

func (kv *KV) Do(ts func(temp kvutils.TempKV))

Do executes a function with a temporary copy of the map. It copies the map back only if the function modifies it.

func (KV) Empty

func (kv KV) Empty() bool

Empty if there are no pairs.

func (KV) Equal

func (kv KV) Equal(other KV) bool

Equal checks kv for equality.

func (*KV) Get

func (kv *KV) Get(key string) (string, bool)

Get the value.

func (KV) Keys

func (kv KV) Keys() []string

Keys returns a sorted list of keys.

func (KV) Len

func (kv KV) Len() int

Len returns the number of keys.

func (*KV) Raw

func (kv *KV) Raw() map[string]string

Raw returns the raw map.

Raw map should not be modified outside of the call.

func (*KV) Set

func (kv *KV) Set(key, value string)

Set the key value.

Setting the value copies the map, so metadata copies share common storage as long as possible.

func (KV) ToYAML

func (kv KV) ToYAML(label string) []*yaml.Node

ToYAML returns a set of YAML nodes.

Jump to

Keyboard shortcuts

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