kv

package
v0.3.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: MPL-2.0 Imports: 2 Imported by: 0

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) 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