tool

package
Version: v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2020 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Tools = New()

Functions

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

Types

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)

*

* GBK2UTF8

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)

*

* UTF82GBK

Source Files

Jump to

Keyboard shortcuts

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