util

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomizeBytes

func RandomizeBytes(in []byte) []byte

func RemoveDirContents

func RemoveDirContents(dir string) error

func Ripemd160

func Ripemd160(in []byte) ([]byte, error)

func Ripemd160Checksum

func Ripemd160Checksum(in []byte) ([]byte, error)

func Sha512Checksum

func Sha512Checksum(in []byte) ([]byte, error)

func ToBytes

func ToBytes(in interface{}) []byte

func ToFixed

func ToFixed(num float64, precision int) float64

func ToFixedRounded

func ToFixedRounded(num float64, precision int) float64

func ToMap

func ToMap(in interface{}) map[string]interface{}

func ToPrecisionString

func ToPrecisionString(value float64, precision int) string

func WaitForCondition

func WaitForCondition(d time.Duration, testFn func() bool) bool

WaitForCondition is a testify Condition for timeout based testing

Types

type ByteReader

type ByteReader struct {
	io.Reader
}

func (ByteReader) ReadByte

func (br ByteReader) ReadByte() (byte, error)

type StringBuilder

type StringBuilder []string

func (*StringBuilder) AddTemplate

func (sb *StringBuilder) AddTemplate(t *template.Template, name string, data interface{}) error

func (*StringBuilder) Append

func (sb *StringBuilder) Append(s string)

func (*StringBuilder) Join

func (sb *StringBuilder) Join(s *StringBuilder)

func (*StringBuilder) String

func (sb *StringBuilder) String() string

type TypeDecoder

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

func NewTypeDecoder

func NewTypeDecoder(r io.Reader) *TypeDecoder

func (*TypeDecoder) Decode

func (p *TypeDecoder) Decode(v interface{}) error

func (*TypeDecoder) DecodeNumber

func (p *TypeDecoder) DecodeNumber(v interface{}) error

func (*TypeDecoder) DecodeString

func (p *TypeDecoder) DecodeString(v interface{}) error

func (*TypeDecoder) DecodeUVarint

func (p *TypeDecoder) DecodeUVarint(v interface{}) error

func (*TypeDecoder) ReadBytes

func (p *TypeDecoder) ReadBytes(v interface{}, len uint64) error

type TypeEncoder

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

func NewTypeEncoder

func NewTypeEncoder(w io.Writer) *TypeEncoder

func (*TypeEncoder) Encode

func (p *TypeEncoder) Encode(v interface{}) error

func (*TypeEncoder) EncodeNumber

func (p *TypeEncoder) EncodeNumber(v interface{}) error

func (*TypeEncoder) EncodeString

func (p *TypeEncoder) EncodeString(v string) error

func (*TypeEncoder) EncodeStringSlice

func (p *TypeEncoder) EncodeStringSlice(v []string) error

func (*TypeEncoder) EncodeUVarint

func (p *TypeEncoder) EncodeUVarint(i uint64) error

func (*TypeEncoder) EncodeVarint

func (p *TypeEncoder) EncodeVarint(i int64) error

type TypeMarshaller

type TypeMarshaller interface {
	Marshal(enc *TypeEncoder) error
}

type TypeUnmarshaller

type TypeUnmarshaller interface {
	Unmarshal(enc *TypeDecoder) error
}

Jump to

Keyboard shortcuts

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