util

package
v0.0.0-...-3f3ae68 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFloatStrings

func AddFloatStrings(a, b string) (string, error)

func CalculateGasFee

func CalculateGasFee(gasLimitStr, gasPriceStr string) (gasFeeStr string, err error)

CalculateGasFee 计算最终的GasFee

func ConvertTimestampToFormat

func ConvertTimestampToFormat(timestamp int64) string

ConvertTimestampToFormat 时间戳转换成日期格式

func GweiToEther

func GweiToEther(gwei string) (string, error)

GweiToEther GweiToEther 将 gwei 转换为 ether

func HttpDelete

func HttpDelete(url string, data []byte, header ...byte) ([]byte, error)

func HttpGet

func HttpGet(url string, header ...byte) ([]byte, error)

func HttpPost

func HttpPost(url string, data []byte, header ...byte) ([]byte, error)

func HttpPut

func HttpPut(url string, data []byte, header ...byte) ([]byte, error)

func If

func If(condition bool, trueValue, falseValue interface{}) interface{}

func Int64ToBytes

func Int64ToBytes(n int64) []byte

func IsMainCoin

func IsMainCoin(currency string) bool

func Md5

func Md5(s string) string

func Md5GenerateSaltedHash

func Md5GenerateSaltedHash(password string, salt int64) string

func MultiplyFloatStrings

func MultiplyFloatStrings(a, b string) (string, error)

MultiplyFloatStrings 两个字符串类型的浮点数相乘

func RFC3339ToNormalTime

func RFC3339ToNormalTime(rfc3339 string) string

RFC3339ToNormalTime RFC3339 日期格式标准化

func ShiftBalance

func ShiftBalance(balance, precision string) (string, error)

ShiftBalance 按精度转换

func StringArrayToString

func StringArrayToString(arr []string) string

将一个string类型的数组转换成string类型用逗号分割的字符串

func ValidatePassword

func ValidatePassword(password string) bool

func WeiToEther

func WeiToEther(wei string) (string, error)

WeiToEther 将 Wei 转换为 Ether

Types

type SnowflakeIDGenerator

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

SnowflakeIDGenerator 结构体定义

func NewSnowflakeIDGenerator

func NewSnowflakeIDGenerator(epoch, nodeID, sequenceBits, nodeIDBits int64) *SnowflakeIDGenerator

NewSnowflakeIDGenerator 创建一个新的SnowflakeIDGenerator

func (*SnowflakeIDGenerator) Generate

func (gen *SnowflakeIDGenerator) Generate() int64

Generate 生成一个雪花ID

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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