Documentation ¶
Index ¶
- Variables
- func AppendHTMLEscape(dst []byte, s string) []byte
- func AppendHTMLEscapeBytes(dst, s []byte) []byte
- func AppendHTTPDate(dst []byte, date time.Time) []byte
- func AppendIPv4(dst []byte, ip net.IP) []byte
- func AppendQuotedArg(dst, src []byte) []byte
- func AppendUint(dst []byte, n int) []byte
- func ParseHTTPDate(date []byte) (time.Time, error)
- func ParseIPv4(dst net.IP, ipStr []byte) (net.IP, error)
- func ParseUfloat(buf []byte) (float64, error)
- func ParseUint(buf []byte) (int, error)
- func ReleaseArgs(a *Args)
- func ReleaseByteBuffer(b *ByteBuffer)
- type Args
- func (a *Args) Add(key, value string)
- func (a *Args) AddBytesK(key []byte, value string)
- func (a *Args) AddBytesKV(key, value []byte)
- func (a *Args) AddBytesV(key string, value []byte)
- func (a *Args) AppendBytes(dst []byte) []byte
- func (a *Args) CopyTo(dst *Args)
- func (a *Args) Del(key string)
- func (a *Args) DelBytes(key []byte)
- func (a *Args) GetBool(key string) bool
- func (a *Args) GetUfloat(key string) (float64, error)
- func (a *Args) GetUfloatOrZero(key string) float64
- func (a *Args) GetUint(key string) (int, error)
- func (a *Args) GetUintOrZero(key string) int
- func (a *Args) Has(key string) bool
- func (a *Args) HasBytes(key []byte) bool
- func (a *Args) Len() int
- func (a *Args) Parse(s string)
- func (a *Args) ParseBytes(b []byte)
- func (a *Args) Peek(key string) []byte
- func (a *Args) PeekBytes(key []byte) []byte
- func (a *Args) PeekMulti(key string) [][]byte
- func (a *Args) PeekMultiBytes(key []byte) [][]byte
- func (a *Args) QueryString() []byte
- func (a *Args) Reset()
- func (a *Args) Set(key, value string)
- func (a *Args) SetBytesK(key []byte, value string)
- func (a *Args) SetBytesKV(key, value []byte)
- func (a *Args) SetBytesV(key string, value []byte)
- func (a *Args) SetUint(key string, value int)
- func (a *Args) SetUintBytes(key []byte, value int)
- func (a *Args) String() string
- func (a *Args) VisitAll(f func(key, value []byte))
- func (a *Args) WriteTo(w io.Writer) (int64, error)
- type BufferPool
- type BufioReader
- func (b *BufioReader) Buffered() int
- func (b *BufioReader) Count() int64
- func (b *BufioReader) Discard(n int) (discarded int, err error)
- func (b *BufioReader) Read(p []byte) (int, error)
- func (b *BufioReader) ReadByte() (byte, error)
- func (b *BufioReader) Reset(r io.Reader)
- func (b *BufioReader) ResetCount()
- func (b *BufioReader) ResetLimit(limit int64)
- type BufioWriter
- func (b *BufioWriter) Available() int
- func (b *BufioWriter) Buffered() int
- func (b *BufioWriter) Count() int64
- func (b *BufioWriter) Flush() error
- func (b *BufioWriter) ReadFrom(r io.Reader) (int64, error)
- func (b *BufioWriter) Reset(w io.Writer)
- func (b *BufioWriter) ResetCount()
- func (b *BufioWriter) Write(p []byte) (int, error)
- func (b *BufioWriter) WriteByte(c byte) error
- func (b *BufioWriter) WriteRune(r rune) (int, error)
- func (b *BufioWriter) WriteString(s string) (int, error)
- type ByteBuffer
- func (b *ByteBuffer) Bytes() []byte
- func (b *ByteBuffer) ChangeLen(newLen int)
- func (b *ByteBuffer) Len() int
- func (b *ByteBuffer) ReadFrom(r io.Reader) (int64, error)
- func (b *ByteBuffer) Reset()
- func (b *ByteBuffer) Set(p []byte)
- func (b *ByteBuffer) SetString(s string)
- func (b *ByteBuffer) String() string
- func (b *ByteBuffer) Write(p []byte) (int, error)
- func (b *ByteBuffer) WriteByte(c byte) error
- func (b *ByteBuffer) WriteString(s string) (int, error)
- func (b *ByteBuffer) WriteTo(w io.Writer) (int64, error)
- type ReaderWrap
- type WriterWrap
Constants ¶
This section is empty.
Variables ¶
var ErrNoArgValue = errors.New("no Args value for the given key")
ErrNoArgValue is returned when Args value with the given key is missing.
Functions ¶
func AppendHTMLEscape ¶
AppendHTMLEscape appends html-escaped s to dst and returns the extended dst.
func AppendHTMLEscapeBytes ¶
AppendHTMLEscapeBytes appends html-escaped s to dst and returns the extended dst.
func AppendHTTPDate ¶
AppendHTTPDate appends HTTP-compliant (RFC1123) representation of date to dst and returns the extended dst.
func AppendIPv4 ¶
AppendIPv4 appends string representation of the given ip v4 to dst and returns the extended dst.
func AppendQuotedArg ¶
AppendQuotedArg appends url-encoded src to dst and returns appended dst.
func AppendUint ¶
AppendUint appends n to dst and returns the extended dst.
func ParseHTTPDate ¶
ParseHTTPDate parses HTTP-compliant (RFC1123) date.
func ParseUfloat ¶
ParseUfloat parses unsigned float from buf.
func ReleaseArgs ¶
func ReleaseArgs(a *Args)
ReleaseArgs returns the object acquired via AquireArgs to the pool.
Do not access the released Args object, otherwise data races may occur.
func ReleaseByteBuffer ¶
func ReleaseByteBuffer(b *ByteBuffer)
ReleaseByteBuffer returns byte buffer to the pool.
ByteBuffer.B mustn't be touched after returning it to the pool. Otherwise data races will occur.
Types ¶
type Args ¶
type Args struct {
// contains filtered or unexported fields
}
Args represents query arguments.
It is forbidden copying Args instances. Create new instances instead and use CopyTo().
Args instance MUST NOT be used from concurrently running goroutines.
func AcquireArgs ¶
func AcquireArgs() *Args
AcquireArgs returns an empty Args object from the pool.
The returned Args may be returned to the pool with ReleaseArgs when no longer needed. This allows reducing GC load.
func (*Args) AddBytesK ¶
AddBytesK adds 'key=value' argument.
Multiple values for the same key may be added.
func (*Args) AddBytesKV ¶
AddBytesKV adds 'key=value' argument.
Multiple values for the same key may be added.
func (*Args) AddBytesV ¶
AddBytesV adds 'key=value' argument.
Multiple values for the same key may be added.
func (*Args) AppendBytes ¶
AppendBytes appends query string to dst and returns the extended dst.
func (*Args) GetBool ¶
GetBool returns boolean value for the given key.
true is returned for '1', 'y' and 'yes' values, otherwise false is returned.
func (*Args) GetUfloatOrZero ¶
GetUfloatOrZero returns ufloat value for the given key.
Zero (0) is returned on error.
func (*Args) GetUintOrZero ¶
GetUintOrZero returns uint value for the given key.
Zero (0) is returned on error.
func (*Args) ParseBytes ¶
ParseBytes parses the given b containing query args.
func (*Args) Peek ¶
Peek returns query arg value for the given key.
Returned value is valid until the next Args call.
func (*Args) PeekBytes ¶
PeekBytes returns query arg value for the given key.
Returned value is valid until the next Args call.
func (*Args) PeekMultiBytes ¶
PeekMultiBytes returns all the arg values for the given key.
func (*Args) QueryString ¶
QueryString returns query string for the args.
The returned value is valid until the next call to Args methods.
func (*Args) SetBytesKV ¶
SetBytesKV sets 'key=value' argument.
func (*Args) SetUintBytes ¶
SetUintBytes sets uint value for the given key.
type BufferPool ¶
type BufferPool struct {
// contains filtered or unexported fields
}
Pool represents byte buffer pool.
Distinct pools may be used for distinct types of byte buffers. Properly determined byte buffer types with their own pools may help reducing memory waste.
func (*BufferPool) Get ¶
func (p *BufferPool) Get() *ByteBuffer
Get returns new byte buffer with zero length.
The byte buffer may be returned to the pool via Put after the use in order to minimize GC overhead.
func (*BufferPool) Put ¶
func (p *BufferPool) Put(b *ByteBuffer)
Put releases byte buffer obtained via Get to the pool.
The buffer mustn't be accessed after returning to the pool.
type BufioReader ¶
type BufioReader struct {
// contains filtered or unexported fields
}
func NewBufioReader ¶
func NewBufioReader(r io.Reader, limit ...int64) *BufioReader
func NewBufioReaderSize ¶
func NewBufioReaderSize(r io.Reader, size int, limit ...int64) *BufioReader
func (*BufioReader) Buffered ¶
func (b *BufioReader) Buffered() int
func (*BufioReader) Count ¶
func (b *BufioReader) Count() int64
func (*BufioReader) ReadByte ¶
func (b *BufioReader) ReadByte() (byte, error)
func (*BufioReader) Reset ¶
func (b *BufioReader) Reset(r io.Reader)
func (*BufioReader) ResetCount ¶
func (b *BufioReader) ResetCount()
func (*BufioReader) ResetLimit ¶
func (b *BufioReader) ResetLimit(limit int64)
type BufioWriter ¶
type BufioWriter struct {
// contains filtered or unexported fields
}
func NewBufioWriter ¶
func NewBufioWriter(w io.Writer) *BufioWriter
func NewBufioWriterSize ¶
func NewBufioWriterSize(w io.Writer, size int) *BufioWriter
func (*BufioWriter) Available ¶
func (b *BufioWriter) Available() int
func (*BufioWriter) Buffered ¶
func (b *BufioWriter) Buffered() int
func (*BufioWriter) Count ¶
func (b *BufioWriter) Count() int64
func (*BufioWriter) Flush ¶
func (b *BufioWriter) Flush() error
func (*BufioWriter) Reset ¶
func (b *BufioWriter) Reset(w io.Writer)
func (*BufioWriter) ResetCount ¶
func (b *BufioWriter) ResetCount()
func (*BufioWriter) WriteByte ¶
func (b *BufioWriter) WriteByte(c byte) error
func (*BufioWriter) WriteString ¶
func (b *BufioWriter) WriteString(s string) (int, error)
type ByteBuffer ¶
type ByteBuffer struct { // B is a byte buffer to use in append-like workloads. // See example code for details. B []byte }
ByteBuffer provides byte buffer, which can be used for minimizing memory allocations.
ByteBuffer may be used with functions appending data to the given []byte slice. See example code for details.
Use Get for obtaining an empty byte buffer.
func AcquireByteBuffer ¶
func AcquireByteBuffer() *ByteBuffer
AcquireByteBuffer returns an empty byte buffer from the pool.
Got byte buffer may be returned to the pool via Put call. This reduces the number of memory allocations required for byte buffer management.
func (*ByteBuffer) Bytes ¶
func (b *ByteBuffer) Bytes() []byte
Bytes returns b.B, i.e. all the bytes accumulated in the buffer.
The purpose of this function is bytes.Buffer compatibility.
func (*ByteBuffer) ChangeLen ¶
func (b *ByteBuffer) ChangeLen(newLen int)
Reset makes ByteBuffer.B empty.
func (*ByteBuffer) ReadFrom ¶
func (b *ByteBuffer) ReadFrom(r io.Reader) (int64, error)
ReadFrom implements io.ReaderFrom.
The function appends all the data read from r to b.
func (*ByteBuffer) SetString ¶
func (b *ByteBuffer) SetString(s string)
SetString sets ByteBuffer.B to s.
func (*ByteBuffer) String ¶
func (b *ByteBuffer) String() string
String returns string representation of ByteBuffer.B.
func (*ByteBuffer) Write ¶
func (b *ByteBuffer) Write(p []byte) (int, error)
Write implements io.Writer - it appends p to ByteBuffer.B
func (*ByteBuffer) WriteByte ¶
func (b *ByteBuffer) WriteByte(c byte) error
WriteByte appends the byte c to the buffer.
The purpose of this function is bytes.Buffer compatibility.
The function always returns nil.
func (*ByteBuffer) WriteString ¶
func (b *ByteBuffer) WriteString(s string) (int, error)
WriteString appends s to ByteBuffer.B.
type ReaderWrap ¶
type ReaderWrap struct {
// contains filtered or unexported fields
}
func (*ReaderWrap) Readed ¶
func (rp *ReaderWrap) Readed() int
func (*ReaderWrap) Reset ¶
func (rp *ReaderWrap) Reset(r io.Reader)
type WriterWrap ¶
type WriterWrap struct {
// contains filtered or unexported fields
}
func (*WriterWrap) Reset ¶
func (wp *WriterWrap) Reset(w io.Writer)
func (*WriterWrap) Writed ¶
func (wp *WriterWrap) Writed() int