common

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2019 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFilesBase64 added in v0.5.1

func GetFilesBase64(paths []string) (result string, err error)

GetFilesBase64 returns a base64 encoded string of file content of paths.

func GetFullPath

func GetFullPath(path string) (fullPath string)

GetFullPath returns a fullpath of path. Expands `~` to user directory ($HOME environment variable).

func GetMaxLength

func GetMaxLength(list []string) (MaxLength int)

GetMaxLength returns a max length of list. Length is byte length.

func GetOrderNumber added in v0.5.5

func GetOrderNumber(value string, array []string) int

Get order num in array

func GetPassPhase added in v0.5.5

func GetPassPhase(msg string) (input string, err error)

func IsExist

func IsExist(filename string) bool

IsExist returns existence of file.

func MapReduce

func MapReduce(map1, map2 map[string]interface{}) map[string]interface{}

MapReduce sets map1 value to map2 if map1 and map2 have same key, and value of map2 is zero value. Available interface type is string or []string or bool.

WARN: This function returns a map, but updates value of map2 argument too.

func MapToStruct

func MapToStruct(mapVal map[string]interface{}, val interface{}) (ok bool)

MapToStruct sets value of mapVal to public field of val struct. Raises panic if mapVal has keys of private field of val struct or field that val struct doesn't have.

WARN: ok value is not used. Always returns false.

func StructToMap

func StructToMap(val interface{}) (mapVal map[string]interface{}, ok bool)

StructToMap returns a map that converted struct to map. Keys of map are set from public field of struct.

WARN: ok value is not used. Always returns false.

Types

This section is empty.

Jump to

Keyboard shortcuts

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