Versions in this module Expand all Collapse all v0 v0.0.2 May 13, 2020 v0.0.1 May 13, 2020 Changes in this version + const ANSIBgBlack + const ANSIBgBlue + const ANSIBgCyan + const ANSIBgGreen + const ANSIBgMagenta + const ANSIBgRed + const ANSIBgWhite + const ANSIBgYellow + const ANSIBlink + const ANSIBright + const ANSIDim + const ANSIFgBlack + const ANSIFgBlue + const ANSIFgCyan + const ANSIFgGreen + const ANSIFgMagenta + const ANSIFgRed + const ANSIFgWhite + const ANSIFgYellow + const ANSIHidden + const ANSIReset + const ANSIReverse + const ANSIUnderscore + var ErrAlreadyStarted = errors.New("already started") + var ErrAlreadyStopped = errors.New("already stopped") + var Fmt = func(format string, a ...interface{}) string + var One256 = Word256 + var TimeLayout = "2006-01-02" + var Zero256 = Word256 + func ASCIITrim(s string) string + func Arr(items ...interface{}) []interface + func Black(args ...interface{}) string + func Blue(args ...interface{}) string + func Connect(protoAddr string) (net.Conn, error) + func Cyan(args ...interface{}) string + func EnsureDir(dir string, mode os.FileMode) error + func Exit(s string) + func ExpUint64(a, b uint64) uint64 + func FileExists(filePath string) bool + func Fingerprint(slice []byte) []byte + func GetInt64BE(src []byte) int64 + func GetInt64LE(src []byte) int64 + func GetUint64BE(src []byte) uint64 + func GetUint64LE(src []byte) uint64 + func GoPath() string + func Green(args ...interface{}) string + func GzipIt(source, target string) error + func Int64FromWord256(word Word256) int64 + func IntInSlice(a int, list []int) bool + func IsASCIIText(s string) bool + func IsDirEmpty(name string) (bool, error) + func IsEmpty(o interface{}) bool + func IsHex(s string) bool + func IsTypedNil(o interface{}) bool + func IsZeros(slice []byte) bool + func Kill() error + func LeftPadBytes(slice []byte, l int) []byte + func Magenta(args ...interface{}) string + func MaxInt(a, b int) int + func MaxInt16(a, b int16) int16 + func MaxInt32(a, b int32) int32 + func MaxInt64(a, b int64) int64 + func MaxInt8(a, b int8) int8 + func MaxUint(a, b uint) uint + func MaxUint16(a, b uint16) uint16 + func MaxUint32(a, b uint32) uint32 + func MaxUint64(a, b uint64) uint64 + func MaxUint8(a, b uint8) uint8 + func MinInt(a, b int) int + func MinInt16(a, b int16) int16 + func MinInt32(a, b int32) int32 + func MinInt64(a, b int64) int64 + func MinInt8(a, b int8) int8 + func MinUint(a, b uint) uint + func MinUint16(a, b uint16) uint16 + func MinUint32(a, b uint32) uint32 + func MinUint64(a, b uint64) uint64 + func MinUint8(a, b uint8) uint8 + func MustReadFile(filePath string) []byte + func MustWriteFile(filePath string, contents []byte, mode os.FileMode) + func PanicConsensus(v interface{}) + func PanicCrisis(v interface{}) + func PanicQ(v interface{}) + func PanicSanity(v interface{}) + func ParseDateRange(dateRange string) (startDate, endDate time.Time, err error) + func PrefixEndBytes(prefix []byte) []byte + func Prompt(prompt string, defaultValue string) (string, error) + func ProtocolAndAddress(listenAddr string) (string, string) + func PutInt64BE(dest []byte, i int64) + func PutInt64LE(dest []byte, i int64) + func PutUint64BE(dest []byte, i uint64) + func PutUint64LE(dest []byte, i uint64) + func RandBytes(n int) []byte + func RandFloat32() float32 + func RandFloat64() float64 + func RandInt() int + func RandInt16() int16 + func RandInt31() int32 + func RandInt31n(n int32) int32 + func RandInt32() int32 + func RandInt63() int64 + func RandInt63n(n int64) int64 + func RandInt64() int64 + func RandIntn(n int) int + func RandPerm(n int) []int + func RandStr(length int) string + func RandTime() time.Time + func RandUint() uint + func RandUint16() uint16 + func RandUint16Exp() uint16 + func RandUint32() uint32 + func RandUint32Exp() uint32 + func RandUint64() uint64 + func RandUint64Exp() uint64 + func ReadFile(filePath string) ([]byte, error) + func Red(args ...interface{}) string + func RightPadBytes(slice []byte, l int) []byte + func SearchUint64s(a []uint64, x uint64) int + func Seed(seed int64) + func SplitAndTrim(s, sep, cutset string) []string + func StringInSlice(a string, list []string) bool + func StripHex(s string) string + func TarIt(source, target string) error + func Tempdir(prefix string) (*os.File, string) + func Tempfile(prefix string) (*os.File, string) + func TrapSignal(cb func(sig os.Signal)) + func TrimmedString(b []byte) string + func Tuple256Split(t Tuple256) (Word256, Word256) + func Uint64FromWord256(word Word256) uint64 + func UnGzip(source, target string) error + func UnTar(tarball, target string) error + func White(args ...interface{}) string + func WriteFile(filePath string, contents []byte, mode os.FileMode) error + func WriteFileAtomic(filename string, data []byte, perm os.FileMode) error + func Yellow(args ...interface{}) string + type BaseService struct + Logger log.Logger + func NewBaseService(logger log.Logger, name string, impl Service) *BaseService + func (bs *BaseService) IsRunning() bool + func (bs *BaseService) OnReset() error + func (bs *BaseService) OnStart() error + func (bs *BaseService) OnStop() + func (bs *BaseService) Quit() <-chan struct{} + func (bs *BaseService) Reset() error + func (bs *BaseService) SetLogger(l log.Logger) + func (bs *BaseService) Start() error + func (bs *BaseService) Stop() error + func (bs *BaseService) String() string + func (bs *BaseService) Wait() + type BitArray struct + Bits int + Elems []uint64 + func NewBitArray(bits int) *BitArray + func (bA *BitArray) And(o *BitArray) *BitArray + func (bA *BitArray) Bytes() []byte + func (bA *BitArray) Copy() *BitArray + func (bA *BitArray) GetIndex(i int) bool + func (bA *BitArray) IsEmpty() bool + func (bA *BitArray) IsFull() bool + func (bA *BitArray) MarshalJSON() ([]byte, error) + func (bA *BitArray) Not() *BitArray + func (bA *BitArray) Or(o *BitArray) *BitArray + func (bA *BitArray) PickRandom() (int, bool) + func (bA *BitArray) SetIndex(i int, v bool) bool + func (bA *BitArray) Size() int + func (bA *BitArray) String() string + func (bA *BitArray) StringIndented(indent string) string + func (bA *BitArray) Sub(o *BitArray) *BitArray + func (bA *BitArray) UnmarshalJSON(bz []byte) error + func (bA *BitArray) Update(o *BitArray) + type BufferCloser struct + Closed bool + func NewBufferCloser(buf []byte) *BufferCloser + func (bc *BufferCloser) Close() error + func (bc *BufferCloser) Write(p []byte) (n int, err error) + func (bc *BufferCloser) WriteByte(c byte) error + func (bc *BufferCloser) WriteRune(r rune) (n int, err error) + func (bc *BufferCloser) WriteString(s string) (n int, err error) + type CMap struct + func NewCMap() *CMap + func (cm *CMap) Clear() + func (cm *CMap) Delete(key string) + func (cm *CMap) Get(key string) interface{} + func (cm *CMap) Has(key string) bool + func (cm *CMap) Keys() []string + func (cm *CMap) Set(key string, value interface{}) + func (cm *CMap) Size() int + func (cm *CMap) Values() []interface{} + type Comparable interface + Less func(o interface{}) bool + type Error interface + Cause func() interface{} + Error func() string + Format func(s fmt.State, verb rune) + Message func() string + Stacktrace func() Error + T func() interface{} + Trace func(format string, args ...interface{}) Error + TraceFrom func(offset int, format string, args ...interface{}) Error + WithT func(t interface{}) Error + func ErrorWrap(cause interface{}, format string, args ...interface{}) Error + func NewError(format string, args ...interface{}) Error + func NewErrorWithT(t interface{}, format string, args ...interface{}) Error + type Heap struct + func NewHeap() *Heap + func (h *Heap) Len() int64 + func (h *Heap) Peek() interface{} + func (h *Heap) Pop() interface{} + func (h *Heap) Push(value interface{}, priority int) + func (h *Heap) PushBytes(value interface{}, priority []byte) + func (h *Heap) PushComparable(value interface{}, priority Comparable) + func (h *Heap) Update(value interface{}, priority Comparable) + type HexBytes []byte + func (bz *HexBytes) Unmarshal(data []byte) error + func (bz *HexBytes) UnmarshalJSON(data []byte) error + func (bz HexBytes) Bytes() []byte + func (bz HexBytes) Format(s fmt.State, verb rune) + func (bz HexBytes) Marshal() ([]byte, error) + func (bz HexBytes) MarshalJSON() ([]byte, error) + func (bz HexBytes) String() string + type KI64Pair struct + Key []byte + Value int64 + func (*KI64Pair) Descriptor() ([]byte, []int) + func (*KI64Pair) ProtoMessage() + func (m *KI64Pair) GetKey() []byte + func (m *KI64Pair) GetValue() int64 + func (m *KI64Pair) Reset() + func (m *KI64Pair) String() string + type KI64Pairs []KI64Pair + func (kvs KI64Pairs) Len() int + func (kvs KI64Pairs) Less(i, j int) bool + func (kvs KI64Pairs) Sort() + func (kvs KI64Pairs) Swap(i, j int) + type KVPair struct + Key []byte + Value []byte + func (*KVPair) Descriptor() ([]byte, []int) + func (*KVPair) ProtoMessage() + func (m *KVPair) GetKey() []byte + func (m *KVPair) GetValue() []byte + func (m *KVPair) Reset() + func (m *KVPair) String() string + type KVPairs []KVPair + func (kvs KVPairs) Len() int + func (kvs KVPairs) Less(i, j int) bool + func (kvs KVPairs) Sort() + func (kvs KVPairs) Swap(i, j int) + type PrefixedReader struct + Prefix []byte + func NewPrefixedReader(prefix []byte, reader io.Reader) *PrefixedReader + func (pr *PrefixedReader) Read(p []byte) (n int, err error) + type Rand struct + func NewRand() *Rand + func (r *Rand) Bytes(n int) []byte + func (r *Rand) Float32() float32 + func (r *Rand) Float64() float64 + func (r *Rand) Int() int + func (r *Rand) Int16() int16 + func (r *Rand) Int31() int32 + func (r *Rand) Int31n(n int32) int32 + func (r *Rand) Int32() int32 + func (r *Rand) Int63() int64 + func (r *Rand) Int63n(n int64) int64 + func (r *Rand) Int64() int64 + func (r *Rand) Intn(n int) int + func (r *Rand) Perm(n int) []int + func (r *Rand) Seed(seed int64) + func (r *Rand) Str(length int) string + func (r *Rand) Time() time.Time + func (r *Rand) Uint() uint + func (r *Rand) Uint16() uint16 + func (r *Rand) Uint16Exp() uint16 + func (r *Rand) Uint32() uint32 + func (r *Rand) Uint32Exp() uint32 + func (r *Rand) Uint64() uint64 + func (r *Rand) Uint64Exp() uint64 + type RepeatTimer struct + func NewRepeatTimer(name string, dur time.Duration) *RepeatTimer + func NewRepeatTimerWithTickerMaker(name string, dur time.Duration, tm TickerMaker) *RepeatTimer + func (t *RepeatTimer) Chan() <-chan time.Time + func (t *RepeatTimer) Reset() + func (t *RepeatTimer) Stop() + type Service interface + IsRunning func() bool + OnReset func() error + OnStart func() error + OnStop func() + Quit func() <-chan struct{} + Reset func() error + SetLogger func(log.Logger) + Start func() error + Stop func() error + String func() string + type Task func(i int) (val interface{}, err error, abort bool) + type TaskResult struct + Error error + Value interface{} + type TaskResultCh <-chan TaskResult + type TaskResultSet struct + func Parallel(tasks ...Task) (trs *TaskResultSet, ok bool) + func (trs *TaskResultSet) Channels() []TaskResultCh + func (trs *TaskResultSet) FirstError() error + func (trs *TaskResultSet) FirstValue() interface{} + func (trs *TaskResultSet) LatestResult(index int) (TaskResult, bool) + func (trs *TaskResultSet) Reap() *TaskResultSet + func (trs *TaskResultSet) Wait() *TaskResultSet + type ThrottleTimer struct + Ch chan struct{} + Name string + func NewThrottleTimer(name string, dur time.Duration) *ThrottleTimer + func (t *ThrottleTimer) Set() + func (t *ThrottleTimer) Stop() bool + func (t *ThrottleTimer) Unset() + type Ticker interface + Chan func() <-chan time.Time + Stop func() + type TickerMaker func(dur time.Duration) Ticker + func NewLogicalTickerMaker(source chan time.Time) TickerMaker + type Tuple256 struct + First Word256 + Second Word256 + func (tuple Tuple256) Compare(other Tuple256) int + type Tuple256Slice []Tuple256 + func (p Tuple256Slice) Len() int + func (p Tuple256Slice) Less(i, j int) bool + func (p Tuple256Slice) Sort() + func (p Tuple256Slice) Swap(i, j int) + type Uint64Slice []uint64 + func (p Uint64Slice) Len() int + func (p Uint64Slice) Less(i, j int) bool + func (p Uint64Slice) Search(x uint64) int + func (p Uint64Slice) Sort() + func (p Uint64Slice) Swap(i, j int) + type WithCauser interface + WithCause func(cause interface{}) Error + type Word256 [32]byte + func Int64ToWord256(i int64) Word256 + func LeftPadWord256(bz []byte) (word Word256) + func RightPadWord256(bz []byte) (word Word256) + func Uint64ToWord256(i uint64) Word256 + func (w Word256) Bytes() []byte + func (w Word256) Compare(other Word256) int + func (w Word256) Copy() Word256 + func (w Word256) IsZero() bool + func (w Word256) Postfix(n int) []byte + func (w Word256) Prefix(n int) []byte + func (w Word256) String() string + func (w Word256) TrimmedString() string