maps

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

As strcase.ToCamel does not work for SCREAMING_SNAKE input, we need our own function here

Index

Constants

This section is empty.

Variables

View Source
var KeyTransformFunctions = map[string]func(string) string{
	"ToCamel":          ToCamel,
	"ToLowerCamel":     ToLowerCamel,
	"ToKebab":          strcase.ToKebab,
	"ToScreamingKebab": strcase.ToScreamingKebab,
	"ToSnake":          strcase.ToSnake,
	"ToScreamingSnake": strcase.ToScreamingSnake,
}

Functions

func Copy

func Copy(origin map[interface{}]interface{}) map[interface{}]interface{}

func Drop

func Drop(origin, toRemove map[interface{}]interface{}) map[interface{}]interface{}

Drop will remove known entries from a given map recursively.

func ToCamel

func ToCamel(val string) string

func ToLowerCamel

func ToLowerCamel(val string) string

func TransformKeys

func TransformKeys(origin map[interface{}]interface{}, transform string) map[interface{}]interface{}

TransformKeys will transform all keys in the given map recursively with the given transform function, which must exist in the 'KeyTransformFunctions' map.

func Union

func Union(left, right map[interface{}]interface{}) map[interface{}]interface{}

Union will merge two given maps recursive, where the values of the 'right' one will overwrite the ones from the 'left'.

Types

This section is empty.

Jump to

Keyboard shortcuts

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