maps

package
v1.32.0 Latest Latest
Warning

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

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

README

Maps

  • NewStateMap: Creates a new map for managing state flags.
  • SetState: Sets a specific state to true or false.
  • IsState: Checks the current value of a state.
  • ToggleState: Toggles the value of a state.
  • HasState: Checks if a state exists in the map.
  • NewMetadata: Creates a new metadata map for key-value storage.
  • Update: Updates or adds a key-value pair to the metadata map.
  • Value: Retrieves the value of a key from the metadata map.
  • Has: Checks if a key exists in the metadata map.

Examples:

For examples of each function, please checkout EXAMPLES.md


Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metadata

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

func NewMetadata

func NewMetadata() Metadata

func (*Metadata) Has

func (m *Metadata) Has(key string) bool

func (*Metadata) Update

func (m *Metadata) Update(key, value string)

func (*Metadata) Value

func (m *Metadata) Value(key string) string

type StateMap

type StateMap map[string]bool

StateMap hold key as string and value in bool

func NewStateMap

func NewStateMap() StateMap

NewStateMap create new state.

func (StateMap) HasState

func (s StateMap) HasState(stateType string) bool

HasState check if particular state is present in the StateMap

func (StateMap) IsState

func (s StateMap) IsState(stateType string) bool

IsState return the value of the state provided from StateMap

func (StateMap) SetState

func (s StateMap) SetState(stateType string, value bool)

SetState sets a new state with provided value in the StateMap

func (StateMap) ToggleState

func (s StateMap) ToggleState(stateType string)

ToggleState toggles the value of the state with the provided key in the StateMap.

Jump to

Keyboard shortcuts

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