util

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package util contains helpers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnvAsMap

func EnvAsMap() map[string]string

EnvAsMap returns environment variables as string map TODO: might cache it when package init, the problem of doing so is user might call os.Setenv, we also do this in test

func GeneratedHeader

func GeneratedHeader(generator string, template string) string

func LoadDotEnv

func LoadDotEnv(t *testing.T)

TODO: it seems it was designed for test only, but now I need to use it in normal application as well, put in envutil? Deprecated

func MapKeys

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

MapKeys returns keys of a map as string slice in an undermined order NOTE: you can not pass map[string]string because string is not interface{}, you need to convert it, but you can get the keys along the way of converting ...

func MapSortedKeys

func MapSortedKeys(m map[string]interface{}, asc bool) []string

MapKeys returns keys of a map as string slice in an asc/desc order as specified

func MergeStringMap

func MergeStringMap(dst map[string]interface{}, extra map[string]interface{})

MergeStringMap merges the second map to first map, and keep the value of the second map if there is duplicate key

Types

This section is empty.

Directories

Path Synopsis
Package cast convert types safely and drop incompatible types during conversion it is inspired by https://github.com/spf13/cast
Package cast convert types safely and drop incompatible types during conversion it is inspired by https://github.com/spf13/cast
Package color defines color code for pretty print in linux shell, windows is not supported
Package color defines color code for pretty print in linux shell, windows is not supported
Package fsutil adds ignore support for walk
Package fsutil adds ignore support for walk
Package hashutil provides alloc free alternatives for pkg/hash
Package hashutil provides alloc free alternatives for pkg/hash
Package logutil is a registry of loggers, it is required for all lib and app that use gommon/log.
Package logutil is a registry of loggers, it is required for all lib and app that use gommon/log.
Package runtimeutil provides wrapper to get caller, stack etc.
Package runtimeutil provides wrapper to get caller, stack etc.
Package testutil defines helper functions that fails test instead of return error
Package testutil defines helper functions that fails test instead of return error

Jump to

Keyboard shortcuts

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