object

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: MIT Imports: 6 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get[K comparable, V any](object map[K]V, key string) V

Get returns the value of the key in the object. Support key path

Example:

	object.Get(map[string]interface{}{"a": 1}, "a")
 // 1

	object.Get(map[string]interface{}{"a": map[string]interface{}{"b": 2}}, "a.b")
	// 2

func Keys

func Keys[K comparable, V any](object map[K]V) []K

Keys returns the keys of the map.

func Map

func Map[K comparable, V any](object map[K]V, iteratee func(V, K) V) map[K]V

Map returns a new map with the same keys by iteratee function from the map.

func Omit

func Omit[K comparable, V any](object map[K]V, keys ...K) map[K]V

Omit returns a new map with keys omitted from the map.

func OmitBy

func OmitBy[K comparable, V any](object map[K]V, fn func(V, K) bool) map[K]V

OmitBy returns a new map by omitted function from the map.

func Pick

func Pick[K comparable, V any](object map[K]V, keys ...K) map[K]V

Pick returns a new map with keys picked from the map.

func PickBy

func PickBy[K comparable, V any](object map[K]V, fn func(V, K) bool) map[K]V

PickBy returns a new map by picked function from the map.

func ToMap

func ToMap(in any, tag ...string) (map[string]any, error)

ToMap transform struct to an may.

func Values

func Values[K comparable, V any](object map[K]V) []V

Values returns the values of the map.

Types

This section is empty.

Jump to

Keyboard shortcuts

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