tool

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: Apache-2.0 Imports: 14 Imported by: 1

README

Golang常见工具库

文档

GoDoc

Documentation

Overview

package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToString

func BytesToString(b []byte) string

BytesToString

func DateTime

func DateTime(layout string) string

DateTime 获取当前时间

func FormatArrayInterface

func FormatArrayInterface(data interface{}) ([]interface{}, error)

FormatArrayInterface 转成字符串数组

func FormatArrayMap

func FormatArrayMap(data interface{}) ([]map[string]interface{}, error)

FormatArrayMap 转换为map的数组

func FormatArrayString

func FormatArrayString(data interface{}) ([]string, error)

FormatArrayString 转成字符串数组

func FormatFloat

func FormatFloat(data interface{}) (float64, error)

FormatFloat interface{} 转换为浮点

func FormatInt

func FormatInt(data interface{}) (int, error)

FormatInt interface{} 转换为整形

func FormatInt64

func FormatInt64(data interface{}) (int64, error)

FormatInt64 转换成int64

func FormatMapString

func FormatMapString(data interface{}) (map[string]interface{}, error)

FormatMapString 转换为map,key为字符串类型

func FormatMapStringString

func FormatMapStringString(data interface{}) (map[string]string, error)

FormatMapStringString 转换为map类型其中key,value都是字符类型的

func FormatString

func FormatString(data interface{}) (string, error)

FormatString interface{} 转换为字符串

func FormatStringToTime

func FormatStringToTime(layout, value string) (time.Time, error)

FormatStringToTime 字符串转换成Time

func HmacHash

func HmacHash(h func() hash.Hash, key, data string) string

HmacHash HMAC是使用key标记信息的加密hash

func MakeIntSlice

func MakeIntSlice(row, column int) [][]int

MakeSlice 创建二维切片

func Md5

func Md5(str string) string

Md5 计算字符串的 MD5 散列值

func Md5File

func Md5File(path string) (string, error)

Md5File 计算指定文件的 MD5 散列值

func Rand

func Rand(min, max int) int

Rand 产生一个随机整数

func Sha1

func Sha1(str string) string

Sha1 计算字符串的 sha1 散列值

func Sha1File

func Sha1File(path string) (string, error)

Sha1File 计算文件的 sha1 散列值

func Sha256

func Sha256(str string) string

Sha256 计算字符串的 sha256 散列值

func StringToBytes

func StringToBytes(s string) []byte

StringToBytes string不被编辑的场景可以使用 谨慎 提升性能同时存在安全隐患

func TimeUnix

func TimeUnix() int64

TimeUnix 获取当前时间戳

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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