utils

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2019 License: MIT Imports: 11 Imported by: 17

README

utils Build Status

utils包提供了一些常用的golang函数

  • MD5 生成md5编码;
  • FileExists 判断文件或是目录是否存在;
  • Merge 合并多个同类型的数据;
安装
go get github.com/issue9/utils
文档

Go Walker GoDoc

版权

本项目采用MIT开源授权许可证,完整的授权说明可在LICENSE文件中找到。

Documentation

Overview

Package utils 一些常用的函数集合。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileExists

func FileExists(path string) bool

FileExists 判断文件或是文件夹是否存在

func MD5

func MD5(str string) string

MD5 将一段字符串转换成 md5 编码

func Merge

func Merge(deep bool, elems ...interface{}) error

Merge 合并所有的元素,后一个元素的非零值将取代前一个元素中的值。 deep 是否递归合并子元素。 合并的元素只支持结构体或是结构体指针。

func Round

func Round(v float64) int64

Round 对一个浮点数进行四舍五入取整

func SplitPath

func SplitPath(path string) []string

SplitPath 将路径按分隔符分隔成字符串数组。比如:

/a/b/c  ==>  []string{"a", "b", "c"}

func TraceStack

func TraceStack(level int, msg ...interface{}) (string, error)

TraceStack 返回调用者的堆栈信息

Types

This section is empty.

Jump to

Keyboard shortcuts

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