commandstore

package
v1.0.63-beta.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package commandstore ties framework metadata to the lifetime of a live Cobra command without keeping discarded command trees alive. It owns no declaration semantics; the caller still owns normalization, cloning and authority.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

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

Map is a concurrent command-keyed metadata store. The zero value is ready to use and must not be copied after first use. Values must never reference the command, its tree, or closures capturing either: that would retain the key through the value and defeat weak ownership. Framework DTOs satisfy this. The command tree's owner must keep it alive while its metadata is in use.

func (*Map) Delete

func (m *Map) Delete(cmd *cobra.Command)

func (*Map) Load

func (m *Map) Load(cmd *cobra.Command) (any, bool)

func (*Map) Range

func (m *Map) Range(visit func(key, value any) bool)

Range visits only live commands. Like sync.Map.Range, it is not a consistent snapshot in the presence of concurrent registrations. Expired keys are never returned, even if their asynchronous cleanup has not yet run.

func (*Map) Store

func (m *Map) Store(cmd *cobra.Command, value any)

Jump to

Keyboard shortcuts

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