util

package
v4.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2017 License: AGPL-3.0, AGPL-3.0-or-later Imports: 4 Imported by: 0

Documentation

Overview

Package util contains various general utility functions used throughout the project.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConcatStrings

func ConcatStrings(s ...string) string

ConcatStrings efficiently concatenates strings with only one extra allocation

func HashBuffer

func HashBuffer(buf []byte) string

HashBuffer computes a base64 MD5 hash from a buffer

func Waterfall

func Waterfall(fns ...func() error) (err error)

Waterfall executes a slice of functions until the first error returned. This error, if any, is returned to the caller.

func WrapError

func WrapError(text string, err error) error

WrapError wraps error types to create compound error chains

Types

type MessageBuffer

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

MessageBuffer provides bufferring and concatenation for post update messages

func (*MessageBuffer) Flush

func (b *MessageBuffer) Flush() ([]byte, uint64)

Flush flushes b into into a []byte and returns it together with the flushed message count. If no messages are stored, the returned buffer is nil.

func (*MessageBuffer) Write

func (b *MessageBuffer) Write(data []byte)

Write writes a message to b

type PausableTicker

type PausableTicker struct {
	C <-chan time.Time
	// contains filtered or unexported fields
}

PausableTicker is a time.Ticker that can be paused

func (*PausableTicker) Pause

func (p *PausableTicker) Pause()

Pause pauses p

func (*PausableTicker) Start

func (p *PausableTicker) Start()

Start starts p

func (*PausableTicker) StartIfPaused

func (p *PausableTicker) StartIfPaused()

StartIfPaused start p back up, if p is paused

Jump to

Keyboard shortcuts

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