util

package
v0.0.0-...-da19eeb Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinaryEncodeStruct

func BinaryEncodeStruct(enc *TypeEncoder, v interface{}) error

func Dump

func Dump(descr string, in interface{})

func DumpJSON

func DumpJSON(descr string, in interface{})

func EncodeToBytes

func EncodeToBytes(v TypeMarshaller) ([]byte, error)

func JoinHome

func JoinHome(p string) (string, error)

func RandomizeBytes

func RandomizeBytes(in []byte) []byte

func SafeUnquote

func SafeUnquote(in string) (string, 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 WaitForCondition

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

WaitForCondition is a testify Condition for timeout based testing

Types

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 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) EncodeBytes

func (p *TypeEncoder) EncodeBytes(bs []byte) error

func (*TypeEncoder) EncodeNumber

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

func (*TypeEncoder) EncodeString

func (p *TypeEncoder) EncodeString(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
}

Jump to

Keyboard shortcuts

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