Back to

Package tool

Latest Go to latest

The highest tagged major version is .

Published: Jan 15, 2020 | License: GPL2 | Module:



var Tools = New()

func CheckBcrypt

func CheckBcrypt(hashed string, nohashed string) bool


* CheckBcrypt

func CreateBcrypt

func CreateBcrypt(str string) (string, error)


* CreateBcrypt

func CreateMd5

func CreateMd5(str string) string


* CreateMd5

type Tool

type Tool struct {

func New

func New() (t *Tool)


* 返回单例实例
* @method New

func (*Tool) FloatToStr

func (t *Tool) FloatToStr(f float64) string


* float转string

func (*Tool) GBK2UTF8

func (t *Tool) GBK2UTF8(s []byte) ([]byte, error)



func (*Tool) GetRandomString

func (t *Tool) GetRandomString(n int) string


* 生成随机字符串

func (*Tool) IntToStr

func (t *Tool) IntToStr(i int) string


* int转string

func (*Tool) StrToInt

func (t *Tool) StrToInt(str string, def int) (int, error)


* string转int

func (*Tool) StructToMap

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


* 结构体转换成map对象

func (*Tool) StructToStr

func (t *Tool) StructToStr(data interface{}) (string, error)


* struct转成json

func (*Tool) SubString

func (t *Tool) SubString(str string, start, length int) string


* 字符串截取

func (*Tool) TimeFormat

func (t *Tool) TimeFormat(time *time.Time, format string) string


* TimeFormat

func (*Tool) UTF82GB2312

func (t *Tool) UTF82GB2312(s []byte) ([]byte, error)


* UTF82GB2312

func (*Tool) UTF82GBK

func (t *Tool) UTF82GBK(s []byte) ([]byte, error)



Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier