tools

package
v0.0.0-...-d64fc3f Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64ToImage

func Base64ToImage(imageBase64 string) ([]byte, error)

func BigIntToETHBigFloat

func BigIntToETHBigFloat(f *big.Int) *big.Float

func BigIntToUsdtBigFloat

func BigIntToUsdtBigFloat(f *big.Int) *big.Float

func ChangeFloat2Float

func ChangeFloat2Float(f string, m int) string

精度处理

func ChangeInt2Float

func ChangeInt2Float(f string, m int) string

精度处理

func ChangeNumber

func ChangeNumber(f float64, m int) string

保留小数位

func CheckExist

func CheckExist(src string) (bool, error)

CheckExist 检查文件是否存在

func CheckFloat

func CheckFloat(value string, decimal int) bool

小数点位数校验

func CheckPermission

func CheckPermission(src string) (bool, error)

CheckPermission 检查文件权限

func CompareHashAndPassword

func CompareHashAndPassword(e string, p string) (bool, error)

CompareHashAndPassword 比较hash

func Decode

func Decode(b string) []byte

Decode decodes a modified base58 string to a byte slice.

func Encode

func Encode(b []byte) string

Encode encodes a byte slice to a modified base58 string.

func FileCreate

func FileCreate(content bytes.Buffer, name string) (err error)

func FileRemove

func FileRemove(name string) (err error)

func FileZip

func FileZip(dst, src string, notContPath string) (err error)

FileZip 文件ZIP压缩

func Float2Int

func Float2Int(f float64, decimal int) uint64

浮点数精度处理转换整数

func Float2String

func Float2String(value string, decimal int) string

将字符串float进行精度处理

func GetCurrentPath

func GetCurrentPath() string

获取当前路径,比如:E:/abc/data/test

func GetDirFiles

func GetDirFiles(dir string) ([]string, error)

func GetExt

func GetExt(fileName string) string

获取文件后缀

func GetGID

func GetGID() (n uint64, err error)

GetGID 获取当前协程id

func GetLocalNetDeviceNames

func GetLocalNetDeviceNames() (names []string, err error)

GetLocalNetDeviceNames 获取网卡名

func GetOrderid

func GetOrderid() string

func GetSize

func GetSize(f multipart.File) (int, error)

获取文件大小

func GetUUID

func GetUUID() string

func HexToBigInt

func HexToBigInt(hex string) *big.Int

func Hmac

func Hmac(data string) string

func IdsStrToIdsIntGroup

func IdsStrToIdsIntGroup(keys string) []int

func IsNotExistMkDir

func IsNotExistMkDir(src string) error

IsNotExistMkDir 如果不存在则新建文件夹

func IsStringEmpty

func IsStringEmpty(str string) bool

func MkDir

func MkDir(src string) error

MkDir 新建文件夹

func Open

func Open(name string, flag int, perm os.FileMode) (*os.File, error)

打开文件

func PathCreate

func PathCreate(dir string) error

func PathExists

func PathExists(path string) (bool, error)

func PathRemove

func PathRemove(name string) (err error)

func RemoveRepByMap

func RemoveRepByMap(slc []string) []string

slice去重

func Round

func Round(f float64, n int) float64

精度处理

func Struct2Map

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

结构体转为map

func SubByZero

func SubByZero(str string) string

截取字符串-将字符串前面的0去掉

func ToBigFloat

func ToBigFloat(str string) *big.Float

func ToHex

func ToHex(b []byte) string

func TrxBase58AddressToHex

func TrxBase58AddressToHex(b58Address string) string

func TrxHexAddressToBase58

func TrxHexAddressToBase58(hexAddress string) string

func ValiedParam

func ValiedParam(params []string) bool

参数解析

Types

type ReplaceHelper

type ReplaceHelper struct {
	Root    string //路径
	OldText string //需要替换的文本
	NewText string //新的文本
}

func (*ReplaceHelper) DoWrok

func (h *ReplaceHelper) DoWrok() error

Jump to

Keyboard shortcuts

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