common

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Hasher = func(data ...[]byte) []byte {
	hasher := sha256.New()
	for i := 0; i < len(data); i++ {
		hasher.Write(data[i])
	}
	return hasher.Sum(nil)
}

Hasher exports default hash function for trie

Functions

func Compactz added in v0.8.1

func Compactz(argv []byte) []byte

Compactz returns nil if argument is empty or zero

func GobDecode added in v0.8.2

func GobDecode(v []byte, e interface{}) error

GobDecode decodes a gob-encoded value v.

func GobEncode added in v0.8.2

func GobEncode(e interface{}) ([]byte, error)

GobEncode encodes e by using gob and returns.

func HandleKillSig

func HandleKillSig(handler func(), logger *log.Logger) interrupt

HandleKillSig gets killing signals (interrupt, quit and terminate) and calls a registered handler function for cleanup. Finally, this will exit program

func IsZero added in v0.8.1

func IsZero(argv []byte) bool

IsZero returns true if argument is empty or zero

func PathMkdirAll

func PathMkdirAll(paths ...string) string

PathMkdirAll make a path by joining paths and create directory if not exists

Types

This section is empty.

Jump to

Keyboard shortcuts

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