util

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Keys

func Keys[M ~map[K]V, K comparable, V any](m M) []K

Keys returns the keys of the map m. The keys will be an indeterminate order.

func MergeJSON

func MergeJSON(x1, x2 []byte) ([]byte, error)

MergeJSON merges the two JSON byte slices containing x1 and x2, preferring x1 over x2 except where x1 and x2 are JSON objects, in which case the keys from both objects are included and their values merged recursively.

It returns an error if x1 or x2 cannot be JSON-unmarshalled, or the merged JSON is invalid.

func PrettyPrintJSON

func PrettyPrintJSON(content []byte, name string) []byte

func ReadFile

func ReadFile(filePath string) string

ReadFile read a plain or gzipped file and return contents as string

func ReverseMap

func ReverseMap(input map[string]string) map[string]string

Types

This section is empty.

Jump to

Keyboard shortcuts

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