buffer

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMaxSize = errors.New("buffer maximum size")
)

Functions

func Release

func Release(b *Buffer)

Types

type Buffer

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

func Checkout

func Checkout(maxSize int) *Buffer

func New

func New(min uint32, max uint32) *Buffer

func (Buffer) Bytes

func (b Buffer) Bytes() ([]byte, error)

func (*Buffer) Error

func (b *Buffer) Error() error

func (*Buffer) Len

func (b *Buffer) Len() int

func (*Buffer) Max

func (b *Buffer) Max() int

func (*Buffer) MustString

func (b *Buffer) MustString() string

func (*Buffer) Release

func (b *Buffer) Release()

func (*Buffer) Reset

func (b *Buffer) Reset()

func (Buffer) SqliteBytes

func (b Buffer) SqliteBytes() ([]byte, error)

optimization for passing the result to the ExecTerminated method of sqlite.Conn.

func (*Buffer) String

func (b *Buffer) String() (string, error)

func (*Buffer) Truncate

func (b *Buffer) Truncate(n int)

func (*Buffer) Write

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

func (*Buffer) WriteByte

func (b *Buffer) WriteByte(byte byte)

func (*Buffer) WriteByteUnsafe

func (b *Buffer) WriteByteUnsafe(byte byte)

Our caller knows that there's enough space in data (probably because it used WritePad)

func (*Buffer) WritePad

func (b *Buffer) WritePad(data []byte, padSize int)

Write and ensure enough capacity for len(data) + padSize Meant to be used with WriteByteUnsafe.

func (*Buffer) WriteString

func (b *Buffer) WriteString(data string)

func (*Buffer) WriteUnsafe

func (b *Buffer) WriteUnsafe(data string)

type Config

type Config struct {
	Count uint16 `json:"count"`
	Min   uint32 `json:"min"`
	Max   uint32 `json:"max"`
}

type Pool

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

func NewPool

func NewPool(count uint16, minSize uint32, maxSize uint32) *Pool

func NewPoolFromConfig

func NewPoolFromConfig(config Config) *Pool

func (*Pool) Checkout

func (p *Pool) Checkout(maxSize uint32) *Buffer

func (*Pool) Depleted

func (p *Pool) Depleted() uint64

func (*Pool) Len

func (p *Pool) Len() int

Jump to

Keyboard shortcuts

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