keyvalue

package
v2.0.0-...-4b7107c Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: MIT Imports: 8 Imported by: 0

README

KeyValue Map

Description

A struct and methods for working with maps of key-value data that doesn't involve redoing the same efforts over and over, repeating yourself again and again...endlessly. :-)

Features

TBD

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Interceptor

func Interceptor(sourceFunc func() (KeyValue, error)) (string, error)

Types

type KeyValue

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

func (*KeyValue) FindKey

func (kv *KeyValue) FindKey(key string) (value any, found bool)

FindKey -Return boolean result and value for a given key in the key-value set

func (*KeyValue) FindValue

func (kv *KeyValue) FindValue(target any) (key any, found bool)

FindValue - Return the key where a given value exists in the key-value store and boolean true if found.

func (*KeyValue) FromBytes

func (kv *KeyValue) FromBytes(data *[]byte, lineEnding, columnDelimiter string)

FromBytes - Given a reference to a byte-array, parse by lines and key-value columns, storing internally.

func (*KeyValue) FromCommandShell

func (kv *KeyValue) FromCommandShell(columnDelimiter, lineDelimiter, command string, args ...string) (err error)

FromCommandShell - Execute a command shell and parse its results into the Key-Value Map.

func (*KeyValue) FromString

func (kv *KeyValue) FromString(data *string, lineEnding, columnDelimiter string)

FromString - Given a reference to a string, parse by lines and key-value columns, storing internally.

func (*KeyValue) GetBool

func (kv *KeyValue) GetBool(key string) (value bool, err error)

GetBool - Return the value corresponding to a given key as boolean (if appropriate) or typecheck error

func (*KeyValue) GetFloat

func (kv *KeyValue) GetFloat(key string) (value float64, err error)

GetFloat - Return the value corresponding to a given key as float or typecheck error

func (*KeyValue) GetFloat32

func (kv *KeyValue) GetFloat32(key string) (value float32, err error)

GetFloat32 - Return the value corresponding to a given key as float or typecheck error

func (*KeyValue) GetFloat64

func (kv *KeyValue) GetFloat64(key string) (value float64, err error)

GetFloat64 - Return the value corresponding to a given key as float64 or typecheck error

func (*KeyValue) GetInt

func (kv *KeyValue) GetInt(key string) (value int, err error)

GetInt - Return the value corresponding to a given key as int or typecheck error

func (*KeyValue) GetString

func (kv *KeyValue) GetString(key string) (value string, err error)

GetString - Return the value corresponding to a given key as string.

func (*KeyValue) Initialize

func (kv *KeyValue) Initialize(sz int, allowOverwrite OverwriteProtection)

Initialize - Allocate memory for our Key-value map

func (*KeyValue) KeyWidth

func (kv *KeyValue) KeyWidth() (width int)

KeyWidth - Return the maximum width of all keys in the current KeyValue struct

func (*KeyValue) MergeFromKv

func (kv *KeyValue) MergeFromKv(source KeyValue)

MergeFromKv - Merge a given source KeyValue into the current struct

func (*KeyValue) RenameKey

func (kv *KeyValue) RenameKey(currKey, newKey string) bool

RenameKey - Return the maximum width of all values in the current KeyValue struct

func (*KeyValue) SetBool

func (kv *KeyValue) SetBool(key string, value bool)

SetBool - For a given key and value, store the same in our key-value store

func (*KeyValue) SetFloat

func (kv *KeyValue) SetFloat(key string, value float64)

SetFloat - For a given key and value, store the same in our key-value store

func (*KeyValue) SetFloat32

func (kv *KeyValue) SetFloat32(key string, value float32)

SetFloat32 - For a given key and value, store the same in our key-value store

func (*KeyValue) SetFloat64

func (kv *KeyValue) SetFloat64(key string, value float64)

SetFloat64 - For a given key and value, store the same in our key-value store

func (*KeyValue) SetInt

func (kv *KeyValue) SetInt(key string, value int)

SetInt - For a given key and value, store the same in our key-value store

func (*KeyValue) SetString

func (kv *KeyValue) SetString(key string, value string)

SetString - For a given key and value, store the same in our key-value store

func (*KeyValue) ToString

func (kv *KeyValue) ToString(columnDelimiter string, lineEnding string) (output string)

ToString - Return a flattened set (string) using the given rowFormat

func (*KeyValue) ToStringArray

func (kv *KeyValue) ToStringArray(columnDelimiter string, pretty bool) (output []string)

ToStringArray - Return a list of strings where each row represents a key-value line

func (*KeyValue) ValueWidth

func (kv *KeyValue) ValueWidth() (width int)

ValueWidth - Return the maximum width of all values in the current KeyValue struct

type Map

type Map map[string]any

type OverwriteProtection

type OverwriteProtection bool

Jump to

Keyboard shortcuts

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