propmap

package
v1.2.377 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DebugSetType

func DebugSetType(pm Map, name string)

DebugSetType enables logging for the given map and annotates logs with the given name.

func Delete

func Delete(pm Map, key string)

Delete deletes a properties map entry.

func Empty

func Empty(pm Map) bool

Empty tells if the map is empty.

func ForEach

func ForEach(pm Map, f func(k, v string) error) error

ForEach iterates over a map.

func Set

func Set(pm Map, key string, value interface{})

Set sets a properties map entry.

func SetDefault

func SetDefault(pm Map, key string, value interface{})

SetDefault sets a properties map entry if not already set.

func StringOr

func StringOr(pm Map, key string, def string) string

StringOr returns the string value, or the given value if not found.

This is separate as this special case cannot ever fail.

func Value

func Value[V any](pm Map, key string, def V) (V, error)

Value returns the requested value, or fails if not found.

func ValueOr

func ValueOr[V any](pm Map, key string, def V) (V, error)

ValueOr returns the requested value, or the given value if not found.

func ValueOrP

func ValueOrP[V any](pm Map, key string, def V, errp *error) V

ValueOrP returns the requested value, or the given value if not found.

func ValueP

func ValueP[V any](pm Map, key string, def V, errp *error) V

ValueP returns the requested value, or fails if not found.

Types

type Map

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

Map is a helper to easier deal with maps.

func New

func New() Map

New creates a new map.

func (Map) Equal

func (pm Map) Equal(other Map) bool

func (Map) Hash

func (pm Map) Hash() (uint64, error)

func (Map) MarshalJSON

func (pm Map) MarshalJSON() ([]byte, error)

func (*Map) UnmarshalJSON

func (pm *Map) UnmarshalJSON(data []byte) error

type TriState

type TriState struct {
	Active bool
	Value  bool
}

func (*TriState) Scan

func (t *TriState) Scan(state fmt.ScanState, verb rune) error

func (TriState) String

func (t TriState) String() string

Jump to

Keyboard shortcuts

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