Documentation
¶
Overview ¶
common is a package that summarizes the common processing of lssh package.
Index ¶
- func GetFilesBase64(paths []string) (result string, err error)
- func GetFullPath(path string) (fullPath string)
- func GetMaxLength(list []string) (MaxLength int)
- func GetOrderNumber(value string, array []string) int
- func GetPassPhase(msg string) (input string, err error)
- func IsExist(filename string) bool
- func MapReduce(map1, map2 map[string]interface{}) map[string]interface{}
- func MapToStruct(mapVal map[string]interface{}, val interface{}) (ok bool)
- func NewSHA1Hash(n ...int) string
- func RandomString(n int) string
- func StructToMap(val interface{}) (mapVal map[string]interface{}, ok bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFilesBase64 ¶ added in v0.5.1
GetFilesBase64 returns a base64 encoded string of file content of paths.
func GetFullPath ¶
GetFullPath returns a fullpath of path. Expands `~` to user directory ($HOME environment variable).
func GetMaxLength ¶
GetMaxLength returns a max length of list. Length is byte length.
func GetOrderNumber ¶ added in v0.5.5
Get order num in array
func GetPassPhase ¶ added in v0.5.5
GetPassPhase gets the passphrase from virtual terminal input and returns the result. Works only on UNIX-based OS.
func MapReduce ¶
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 ¶
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 NewSHA1Hash ¶ added in v0.5.6
NewSHA1Hash generates a new SHA1 hash based on a random number of characters.
func RandomString ¶ added in v0.5.6
RandomString generates a random string of n length
func StructToMap ¶
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.