util

package
v4.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2017 License: AGPL-3.0, AGPL-3.0-or-later Imports: 2 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 CloneBytes

func CloneBytes(b []byte) []byte

CloneBytes creates a copy of b

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 Parallel

func Parallel(fns ...func() error) error

Execute functions in parallel. The first error is returned, if any.

func SplitPunctuation

func SplitPunctuation(word []byte) (leading byte, mid []byte, trailing byte)

SplitPunctuation splits off one byte of leading and trailing punctuation, if any, and returns the 3 split parts. If there is no edge punctuation, the respective byte = 0.

func SplitPunctuationString

func SplitPunctuationString(word string) (
	leading byte, mid string, trailing byte,
)

SplitPunctuationString splits off one byte of leading and trailing punctuation, if any, and returns the 3 split parts. If there is no edge punctuation, the respective byte = 0.

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

This section is empty.

Jump to

Keyboard shortcuts

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