util

package
v0.0.0-...-524df1d Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2019 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CopyBufPool = sync.Pool{
	New: func() interface{} {
		return make([]byte, 4096)
	},
}

Functions

func CoarseTimeNow deprecated

func CoarseTimeNow() time.Time

CoarseTimeNow returns the current time truncated to the nearest second.

Deprecated: This is slower than calling time.Now() directly. This is now time.Now().Truncate(time.Second) shortcut.

func CopyZeroAlloc

func CopyZeroAlloc(w io.Writer, r io.Reader) (int64, error)

func CreateFixedBytes

func CreateFixedBytes(bodySize int) []byte

func Round2

func Round2(n int) int

Types

type FlushWriter

type FlushWriter struct {
	Wf writeFlusher
	Bw *bufio.Writer
}

func (*FlushWriter) Write

func (w *FlushWriter) Write(p []byte) (int, error)

type NoCopy

type NoCopy struct{} //nolint:unused

Embed this type into a struct, which mustn't be copied, so `go vet` gives a warning if this struct is copied.

See https://github.com/golang/go/issues/8005#issuecomment-190753527 for details. and also: https://stackoverflow.com/questions/52494458/nocopy-minimal-example

func (*NoCopy) Lock

func (*NoCopy) Lock()

func (*NoCopy) Unlock

func (*NoCopy) Unlock()

Jump to

Keyboard shortcuts

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