utils

package
v0.0.0-...-61197bd Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

*

  • Hash 工具类. *
  • @FileName: hash.go
  • @Auther : 杨雪波
  • @Email : yangxuebo@yeah.net
  • @CreateTime: 2018-07-26 10:44:32
  • @UpdateTime: 2018-07-26 10:44:54

*

  • 通用工具类. *
  • @FileName: utils.go
  • @Auther : 杨雪波
  • @Email : yangxuebo@yeah.net
  • @CreateTime: 2018-07-26 10:44:32
  • @UpdateTime: 2018-07-26 10:44:54

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteToHexString

func ByteToHexString(bytes []byte) string

ByteToHexString ByteToHexString

func BytesToBigInt

func BytesToBigInt(b []byte) *big.Int

BytesToBigInt BytesToBigInt

func DecodeAddress

func DecodeAddress(address string) ([]byte, error)

DecodeAddress 地址解码。

func DecodeB58

func DecodeB58(version uint8, input string) (decodedBytes []byte, err error)

DecodeB58 DecodeB58

func DeepCopy

func DeepCopy(value interface{}) interface{}

DeepCopy 对象深度copy

func EncodeB58

func EncodeB58(version uint8, bytes []byte) string

EncodeB58 EncodeB58

func GetBytes

func GetBytes(value interface{}) []byte

GetBytes 获取字节

func GetFieldNames

func GetFieldNames(obj interface{}) []string

GetFieldNames 获取对象的字段名

func GetFieldValue

func GetFieldValue(obj interface{}, fieldName string) interface{}

GetFieldValue 获取对象字段存储的值

func HexToBytes

func HexToBytes(hexStr string) ([]byte, error)

HexToBytes HexToBytes

func HexToString

func HexToString(hexStr string) (string, error)

HexToString HexToString

func IsHexString

func IsHexString(str string) bool

IsHexString 16进制格式验证

func IsNumberString

func IsNumberString(s string) bool

IsNumberString IsNumberString

func IsNumberType

func IsNumberType(obj interface{}) bool

IsNumberType IsNumberType

func IsStringType

func IsStringType(obj interface{}) bool

func IsValidAddress

func IsValidAddress(address string) bool

IsValidAddress 地址合法性验证

func IsValidAmount

func IsValidAmount(amount *jtConst.Amount) bool

IsValidAmount 金额合法验证

func IsValidAmount0

func IsValidAmount0(amount *jtConst.Amount) bool

IsValidAmount0 金额宽泛式验证

func IsValidCurrency

func IsValidCurrency(currency string) bool

IsValidCurrency 货币合法性验证

func MatchString

func MatchString(patter string, str string) bool

MatchString MatchString

func NumberToString

func NumberToString(obj interface{}) string

NumberToString NumberToString

func Sha256Util

func Sha256Util(sbytes []byte) []byte

Sha256Util Sha256Util

func SortByFieldName

func SortByFieldName(fields []string)

SortByFieldName SortByFieldName

func StringToHex

func StringToHex(str string) string

StringToHex StringToHex

func ToAmount

func ToAmount(amount jtConst.Amount) (interface{}, error)

ToAmount 根据货币类型转换成相应的金额对象。如果是SWT则返回基本数据类型

Types

type FieldWrapper

type FieldWrapper struct {
	// contains filtered or unexported fields
}

FieldWrapper 字段排序包装类

func (FieldWrapper) Len

func (fw FieldWrapper) Len() int

func (FieldWrapper) Less

func (fw FieldWrapper) Less(i, j int) bool

func (FieldWrapper) Swap

func (fw FieldWrapper) Swap(i, j int)

type Sha512

type Sha512 struct {
	// contains filtered or unexported fields
}

Sha512 Sha512

func NewSha512

func NewSha512() *Sha512

NewSha512 NewSha512

func (*Sha512) Add

func (s *Sha512) Add(bytes []byte) (int, error)

Add Add

func (*Sha512) Add32

func (s *Sha512) Add32(i uint32) (int, error)

Add32 Add32

func (*Sha512) Finish

func (s *Sha512) Finish() []byte

Finish Finish

func (*Sha512) Finish128

func (s *Sha512) Finish128() []byte

Finish128 16字节

func (*Sha512) Finish256

func (s *Sha512) Finish256() []byte

Finish256 32字节

type SortBy

type SortBy func(p, q string) bool

SortBy 排序函数

Jump to

Keyboard shortcuts

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