common

package
v1.1.12 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomString

func RandomString(n int) string

RandomString returns a random string of length n.

Types

type BufferPool

type BufferPool struct {
	sync.Pool
}

BufferPool is sync pool for *bytes.Buffer

func NewBufferPool

func NewBufferPool() *BufferPool

NewBufferPool creates a buffer pool.

func (*BufferPool) Get

func (bp *BufferPool) Get() *bytes.Buffer

Get checks out a buffer which must be put back in.

func (*BufferPool) Put

func (bp *BufferPool) Put(b *bytes.Buffer)

Put reurns a buffer which was previously checked out.

type BufferWriter

type BufferWriter interface {
	Write(p []byte) (nn int, err error)
	WriteRune(r rune) (n int, err error)
	WriteString(s string) (n int, err error)
}

BufferWriter a common interface between bytes.Buffer and bufio.Writer

Jump to

Keyboard shortcuts

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