utils

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Delimiter / delimiter for splitting a path.
	Delimiter = "/"
)

Variables

This section is empty.

Functions

func ReadFile added in v0.0.12

func ReadFile(path string) ([]byte, error)

ReadFile reads from a file.

func SortMapKeys

func SortMapKeys(m map[string]interface{}) []string

SortMapKeys sorts the keys of a map.

func SplitPath added in v0.0.4

func SplitPath(path string) (string, string)

SplitPath splits a given path by / and returns the first element and the joined rest paths.

func ToJSON

func ToJSON(m map[string]interface{}) ([]byte, error)

ToJSON marshalls a given map to json.

func ToMapStringInterface added in v0.0.11

func ToMapStringInterface(i interface{}) map[string]interface{}

ToMapStringInterface takes any value and returns the map string interface.

func ToYAML

func ToYAML(m map[string]interface{}) ([]byte, error)

ToYAML marshalls a given map to yaml.

Types

type Keys

type Keys []string

Keys type for receiving all keys of a map.

func (Keys) Len

func (k Keys) Len() int

Len returns the length of Keys.

func (Keys) Less

func (k Keys) Less(i, j int) bool

Less compares keys alphabetically.

func (Keys) Swap

func (k Keys) Swap(i, j int)

Swap swaps keys alphabetically.

Jump to

Keyboard shortcuts

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