utils

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: Apache-2.0, Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EXECUTE_EVM_TX = iota
	FUNC_MAX_NUM
)
View Source
const FLUSH_INTERVAL = 1 * time.Second // statistic cycle

Variables

This section is empty.

Functions

func BinRead

func BinRead(reader io.Reader, data interface{}) error

func BinWrite

func BinWrite(writer io.Writer, data interface{}) error

func CheckItfcNil

func CheckItfcNil(itfc interface{}) bool

func CopyFile

func CopyFile(dstName, srcName string) (written int64, err error)

func Decrypt

func Decrypt(ciphertext, key []byte) ([]byte, error)

func DecryptHexText

func DecryptHexText(hexText string, key []byte) ([]byte, error)

func Encrypt

func Encrypt(plantText, key []byte) ([]byte, error)

func PKCS7Padding

func PKCS7Padding(ciphertext []byte, blockSize int) []byte

func PKCS7UnPadding

func PKCS7UnPadding(plantText []byte, blockSize int) []byte

func PaddingLeft

func PaddingLeft(ori []byte, pad byte, length int) []byte

func PathExists

func PathExists(path string) (bool, error)

func ReadByte

func ReadByte(r io.Reader) (byte, error)

func ReadBytes

func ReadBytes(reader io.Reader) ([]byte, error)

ErrUnexpectedEOF when it is the end

func ReadUint8

func ReadUint8(r io.Reader) (uint8, error)

func ReadVarint

func ReadVarint(r io.Reader) (int, error)

func StartStat

func StartStat()

func Uint32Bytes

func Uint32Bytes(num uint32) []byte

func WriteBytes

func WriteBytes(writer io.Writer, bys []byte) error

func WriteVarint

func WriteVarint(w io.Writer, i int) error

Types

type CountTime

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

type Int64Slice

type Int64Slice []int64

func (Int64Slice) Len

func (p Int64Slice) Len() int

func (Int64Slice) Less

func (p Int64Slice) Less(i, j int) bool

func (Int64Slice) Sort

func (p Int64Slice) Sort()

func (Int64Slice) Swap

func (p Int64Slice) Swap(i, j int)

type StStatistic

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

func CountSlc

func CountSlc(index int) *StStatistic

func (*StStatistic) Add

func (ss *StStatistic) Add(num int64)

func (*StStatistic) Begin

func (ss *StStatistic) Begin() func()

return endFunc if dont call endFunc(), goroutine will leak

func (*StStatistic) End

func (ss *StStatistic) End(endFunc func())

func (*StStatistic) Init

func (ss *StStatistic) Init(name string, threshold time.Duration)

func (*StStatistic) String

func (ss *StStatistic) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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