maps

package
v0.5.12 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: Apache-2.0 Imports: 16 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnyKeys

func AnyKeys[V interface{}](data map[interface{}]V) (keys []interface{})

func CamelizeKeys

func CamelizeKeys[V interface{}](data map[string]V) (camelized map[string]V)

func CopyBaseMap added in v0.5.0

func CopyBaseMap[T BaseTypes](src map[string]T) (dst map[string]T)

func CopyBaseSlice added in v0.5.0

func CopyBaseSlice[V BaseTypes](src []V) (dst []V)

func DebugWalk

func DebugWalk(thing map[string]interface{}) (results string)

func DeepCopy added in v0.5.0

func DeepCopy(src map[string]interface{}) (dst map[string]interface{})

func Delete added in v0.2.2

func Delete(m map[string]interface{}, key string)

func ExtractBoolValue

func ExtractBoolValue(v interface{}) (b bool)

func ExtractEnumValue

func ExtractEnumValue(key string, upper bool, enums []string, data map[string]interface{}) (value string, err error)

func ExtractIntValue

func ExtractIntValue(key string, data map[string]interface{}) (value int, err error)

func FinalizeNjnFieldAttributes

func FinalizeNjnFieldAttributes(attrs map[string]interface{}) (attributes []template.HTMLAttr, err error)

func FinalizeNjnFieldData

func FinalizeNjnFieldData(data map[string]interface{}, field map[string]interface{}, skip ...string) (err error)

func Get

func Get(m map[string]interface{}, key string) (value interface{})

func Has added in v0.5.1

func Has(m map[string]interface{}, key string) (present bool)

func IsMap

func IsMap(v interface{}) (ok bool)

func KebabKeys

func KebabKeys[V interface{}](data map[string]V) (kebabed map[string]V)

func Keys

func Keys[K ~string, V interface{}](data map[K]V) (keys []K)

func MakeTypedKey added in v0.5.0

func MakeTypedKey[K comparable, L comparable, V interface{}, M map[L]V](key K, m map[K]M) (made bool)

func OrderedKeys added in v0.4.0

func OrderedKeys[K cmp.Ordered, V interface{}](data map[K]V) (keys []K)

func ParseKeyIntValue

func ParseKeyIntValue(key string, data map[string]interface{}) (v int, ok bool)

func ParseKeySlice added in v0.5.0

func ParseKeySlice(input string) (key string, idx int, ok bool)

func ParseNjnFieldAttributes

func ParseNjnFieldAttributes(field map[string]interface{}) (attributes map[string]interface{}, classes []string, styles map[string]string, err error)

func PrettyMap added in v0.5.0

func PrettyMap[T comparable, V interface{}](m map[T]V) (pretty string)

func ReverseOrderedKeys added in v0.4.0

func ReverseOrderedKeys[K cmp.Ordered, V interface{}](data map[K]V) (keys []K)

func ReverseSortedKeys

func ReverseSortedKeys[K ~string, V interface{}](data map[K]V) (keys []K)

func Set added in v0.4.0

func Set(m map[string]interface{}, key string, value interface{}) (err error)

func SortedKeyLengths

func SortedKeyLengths[K ~string, V interface{}](data map[K]V) (keys []K)

SortedKeyLengths returns the list of keys natural sorted and from longest to shortest

func SortedKeys

func SortedKeys[K ~string, V interface{}](data map[K]V) (keys []K)

func SortedKeysByLastKeyword

func SortedKeysByLastKeyword[K ~string, V interface{}](data map[K]V) (keys []K)

func SortedKeysByLastName

func SortedKeysByLastName[K ~string, V interface{}](data map[K]V) (keys []K)

func TransformAnyToStringSlice

func TransformAnyToStringSlice(input interface{}) (output []string, ok bool)

func TransformMapAnyToString

func TransformMapAnyToString(input map[string]interface{}) (output map[string]string)

func TypedKeys added in v0.2.15

func TypedKeys[T comparable, V interface{}](data map[T]V) (keys []T)

func ValuesSortedByKeys

func ValuesSortedByKeys[K ~string, V interface{}](data map[K]V) (values []V)

Types

type BaseTypes added in v0.5.0

type BaseTypes interface {
	~bool |
		~string | ~[]byte |
		~float32 | ~float64 |
		~complex64 | ~complex128 |
		~int | ~int8 | ~int16 | ~int32 | ~int64 |
		~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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