slicemap

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2023 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Overview

Package slicemap provides simple slice & map utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyMap

func CopyMap(m map[string]any) map[string]any

CopyMap makes a deep copy of a map.

func Get

func Get[T any](m map[string]any, field string) (res T, ok bool)

Get returns a value from a map in a specified type. If either item is not present or of a different type, ok = false.

func In

func In[T constraints.Ordered](s []T, query T) bool

In check if query is an element of the list.

func Lookup

func Lookup(data map[string]any, path []string) (any, error)

Lookup takes a map and will return a nested key.

func SetValue

func SetValue(data map[string]any, path []string, value any)

SetValue takes a map and will assign a value at the specified path.

Types

This section is empty.

Jump to

Keyboard shortcuts

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