libs

package
v0.0.0-...-3c02317 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendFile

func AppendFile(filename string, output []byte) error

AppendFile writes the contents of the output buffer to a file

func Base64Decode

func Base64Decode(str string) string

*

  • base64 解码
  • @method func
  • @param {[type]} t *Tools [description]
  • @return {[type]} [description]

func Compress

func Compress(files []*os.File, dest string) error

压缩文件 files 文件数组,可以是不同dir下的文件或者文件夹 dest 压缩文件存放地址

func CreateFile

func CreateFile(filePath string) error

调用os.MkdirAll递归创建文件夹

func CreateTemFile

func CreateTemFile(name string, file multipart.File) (string, error)

创建临时文件

func GetRandomString

func GetRandomString(n int) string

生成随机字符串

func HashPassword

func HashPassword(pwd string) string

func IsExist

func IsExist(path string) bool

判断所给路径文件/文件夹是否存在(返回true是存在)

func IsTestEnv

func IsTestEnv() bool

func ParseFlostToString

func ParseFlostToString(f float64) string

*

  • 转换浮点数为string
  • @method func
  • @param {[type]} t * Tools [description]
  • @return {[type]} [description]

func ParseInt

func ParseInt(b string, defInt int) int

*

  • string转换int
  • @method parseInt
  • @param {[type]} b string [description]
  • @return {[type]} [description]

func ParseString

func ParseString(b int) string

*

  • int转换string
  • @method parseInt
  • @param {[type]} b string [description]
  • @return {[type]} [description]

func StructToMap

func StructToMap(obj interface{}) map[string]interface{}

*

  • 结构体转换成map对象
  • @method func
  • @param {[type]} t *Tools [description]
  • @return {[type]} [description]

func StructToString

func StructToString(data interface{}) string

*

  • 结构体转成json 字符串
  • @method StruckToString
  • @param {[type]} data interface{} [description]

func SubString

func SubString(str string, start, length int) string

*

  • 字符串截取
  • @method func
  • @param {[type]} t *Tools [description]
  • @return {[type]} [description]

func TimeFormat

func TimeFormat(time *time.Time) string

*

  • 时间格式化
  • @method func
  • @param {[type]} t *Tools [description]
  • @return {[type]} [description]

func WriteFile

func WriteFile(filename string, output []byte) error

WriteFile writes the contents of the output buffer to a file

Types

This section is empty.

Jump to

Keyboard shortcuts

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