Documentation
¶
Index ¶
- func AccumulativeBufToBytes(dst []byte, val interface{}) ([]byte, error)
- func ChainBufToBytes(dst []byte, val interface{}) ([]byte, error)
- type AccumulativeBuf
- func (b *AccumulativeBuf) Bytes() []byte
- func (b *AccumulativeBuf) BytesCopy() []byte
- func (b *AccumulativeBuf) Cap() int
- func (b AccumulativeBuf) Error() error
- func (b *AccumulativeBuf) Grow(newLen int) *AccumulativeBuf
- func (b *AccumulativeBuf) GrowDelta(delta int) *AccumulativeBuf
- func (b *AccumulativeBuf) Len() int
- func (b *AccumulativeBuf) RangeBytes(off, len int) []byte
- func (b *AccumulativeBuf) RangeBytesCopy(off, len int) []byte
- func (b *AccumulativeBuf) RangeString(off, len int) string
- func (b *AccumulativeBuf) RangeStringCopy(off, len int) string
- func (b *AccumulativeBuf) Replace(old, new []byte, n int) *AccumulativeBuf
- func (b *AccumulativeBuf) ReplaceAll(old, new []byte) *AccumulativeBuf
- func (b *AccumulativeBuf) ReplaceStr(old, new string, n int) *AccumulativeBuf
- func (b *AccumulativeBuf) ReplaceStrAll(old, new string) *AccumulativeBuf
- func (b *AccumulativeBuf) Reset() *AccumulativeBuf
- func (b *AccumulativeBuf) StakeOut() *AccumulativeBuf
- func (b *AccumulativeBuf) StakedBytes() []byte
- func (b *AccumulativeBuf) StakedBytesCopy() []byte
- func (b *AccumulativeBuf) StakedLen() int
- func (b *AccumulativeBuf) StakedOffset() int
- func (b *AccumulativeBuf) StakedString() string
- func (b *AccumulativeBuf) StakedStringCopy() string
- func (b *AccumulativeBuf) String() string
- func (b *AccumulativeBuf) StringCopy() string
- func (b *AccumulativeBuf) Write(p []byte) *AccumulativeBuf
- func (b *AccumulativeBuf) WriteApplyFn(p []byte, fn func(dst, p []byte) []byte) *AccumulativeBuf
- func (b *AccumulativeBuf) WriteApplyFnStr(s string, fn func(dst, p []byte) []byte) *AccumulativeBuf
- func (b *AccumulativeBuf) WriteBool(v bool) *AccumulativeBuf
- func (b *AccumulativeBuf) WriteByte(p byte) *AccumulativeBuf
- func (b *AccumulativeBuf) WriteFloat(f float64) *AccumulativeBuf
- func (b *AccumulativeBuf) WriteInt(i int64) *AccumulativeBuf
- func (b *AccumulativeBuf) WriteMarshallerTo(m MarshallerTo) *AccumulativeBuf
- func (b *AccumulativeBuf) WriteStr(s string) *AccumulativeBuf
- func (b *AccumulativeBuf) WriteUint(u uint64) *AccumulativeBuf
- func (b *AccumulativeBuf) WriteX(x interface{}) *AccumulativeBuf
- type ChainBuf
- func (b *ChainBuf) Bytes() []byte
- func (b *ChainBuf) BytesCopy() []byte
- func (b *ChainBuf) Cap() int
- func (b *ChainBuf) Grow(newLen int) *ChainBuf
- func (b *ChainBuf) GrowDelta(delta int) *ChainBuf
- func (b *ChainBuf) Len() int
- func (b *ChainBuf) Replace(old, new []byte, n int) *ChainBuf
- func (b *ChainBuf) ReplaceAll(old, new []byte) *ChainBuf
- func (b *ChainBuf) ReplaceStr(old, new string, n int) *ChainBuf
- func (b *ChainBuf) ReplaceStrAll(old, new string) *ChainBuf
- func (b *ChainBuf) Reset() *ChainBuf
- func (b *ChainBuf) String() string
- func (b *ChainBuf) StringCopy() string
- func (b *ChainBuf) Write(p []byte) *ChainBuf
- func (b *ChainBuf) WriteApplyFn(p []byte, fn func(dst, p []byte) []byte) *ChainBuf
- func (b *ChainBuf) WriteApplyFnStr(s string, fn func(dst, p []byte) []byte) *ChainBuf
- func (b *ChainBuf) WriteBool(v bool) *ChainBuf
- func (b *ChainBuf) WriteByte(p byte) *ChainBuf
- func (b *ChainBuf) WriteFloat(f float64) *ChainBuf
- func (b *ChainBuf) WriteInt(i int64) *ChainBuf
- func (b *ChainBuf) WriteMarshallerTo(m MarshallerTo) *ChainBuf
- func (b *ChainBuf) WriteStr(s string) *ChainBuf
- func (b *ChainBuf) WriteUint(u uint64) *ChainBuf
- func (b *ChainBuf) WriteX(x interface{}) *ChainBuf
- type MarshallerTo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccumulativeBufToBytes ¶
AccumulativeBufToBytes registers x2bytes conversion function accepts AccumulativeBuf.
func ChainBufToBytes ¶
ChainBufToBytes registers x2bytes conversion function accepts ChainBuf.
Types ¶
type AccumulativeBuf ¶
type AccumulativeBuf struct {
// contains filtered or unexported fields
}
AccumulativeBuf is a wrapper around ChainBuf that allows to accumulate buffer data and use only necessary part.
See StakeOut and Staked* methods.
func (*AccumulativeBuf) Bytes ¶
func (b *AccumulativeBuf) Bytes() []byte
Bytes returns contents of the buffer.
func (*AccumulativeBuf) BytesCopy ¶
func (b *AccumulativeBuf) BytesCopy() []byte
BytesCopy returns copy of buffer contents.
func (*AccumulativeBuf) Cap ¶
func (b *AccumulativeBuf) Cap() int
func (AccumulativeBuf) Error ¶
func (b AccumulativeBuf) Error() error
Get last error caught in Write* methods.
func (*AccumulativeBuf) Grow ¶
func (b *AccumulativeBuf) Grow(newLen int) *AccumulativeBuf
Grow increases length of the buffer.
func (*AccumulativeBuf) GrowDelta ¶
func (b *AccumulativeBuf) GrowDelta(delta int) *AccumulativeBuf
GrowDelta increases length of the buffer to actual length + delta.
See Grow().
func (*AccumulativeBuf) Len ¶
func (b *AccumulativeBuf) Len() int
func (*AccumulativeBuf) RangeBytes ¶
func (b *AccumulativeBuf) RangeBytes(off, len int) []byte
RangeBytes returns buffer bytes from offset off with length len.
func (*AccumulativeBuf) RangeBytesCopy ¶
func (b *AccumulativeBuf) RangeBytesCopy(off, len int) []byte
RangeBytesCopy copies result of RangeBytes().
func (*AccumulativeBuf) RangeString ¶
func (b *AccumulativeBuf) RangeString(off, len int) string
RangeString returns buffer bytes as string from offset off with length len.
func (*AccumulativeBuf) RangeStringCopy ¶
func (b *AccumulativeBuf) RangeStringCopy(off, len int) string
RangeStringCopy copies result of RangeString().
func (*AccumulativeBuf) Replace ¶
func (b *AccumulativeBuf) Replace(old, new []byte, n int) *AccumulativeBuf
Replace replaces old bytes to new in buffer.
func (*AccumulativeBuf) ReplaceAll ¶
func (b *AccumulativeBuf) ReplaceAll(old, new []byte) *AccumulativeBuf
ReplaceAll replace all occurrences of old bytes to new in buffer.
func (*AccumulativeBuf) ReplaceStr ¶
func (b *AccumulativeBuf) ReplaceStr(old, new string, n int) *AccumulativeBuf
ReplaceStr replace old to new substrings in buffer.
func (*AccumulativeBuf) ReplaceStrAll ¶
func (b *AccumulativeBuf) ReplaceStrAll(old, new string) *AccumulativeBuf
ReplaceStrAll replaces all occurrences of old substrings to new in buffer.
func (*AccumulativeBuf) Reset ¶
func (b *AccumulativeBuf) Reset() *AccumulativeBuf
func (*AccumulativeBuf) StakeOut ¶
func (b *AccumulativeBuf) StakeOut() *AccumulativeBuf
StakeOut saves current offset for further use.
func (*AccumulativeBuf) StakedBytes ¶
func (b *AccumulativeBuf) StakedBytes() []byte
StakedBytes returns accumulated bytes from staked offset.
func (*AccumulativeBuf) StakedBytesCopy ¶
func (b *AccumulativeBuf) StakedBytesCopy() []byte
StakedBytesCopy returns copy of accumulated bytes since staked offset.
func (*AccumulativeBuf) StakedLen ¶
func (b *AccumulativeBuf) StakedLen() int
StakedLen returns length of accumulated bytes since staked offset.
func (*AccumulativeBuf) StakedOffset ¶
func (b *AccumulativeBuf) StakedOffset() int
StakedOffset returns staked offset.
func (*AccumulativeBuf) StakedString ¶
func (b *AccumulativeBuf) StakedString() string
StakedString returns accumulated bytes as string.
func (*AccumulativeBuf) StakedStringCopy ¶
func (b *AccumulativeBuf) StakedStringCopy() string
StakedStringCopy returns copy of accumulated bytes as string.
func (*AccumulativeBuf) String ¶
func (b *AccumulativeBuf) String() string
Get contents of the buffer as string.
func (*AccumulativeBuf) StringCopy ¶
func (b *AccumulativeBuf) StringCopy() string
StringCopy returns copy of the buffer contents as string.
func (*AccumulativeBuf) Write ¶
func (b *AccumulativeBuf) Write(p []byte) *AccumulativeBuf
Write bytes to the buffer.
func (*AccumulativeBuf) WriteApplyFn ¶ added in v1.0.2
func (b *AccumulativeBuf) WriteApplyFn(p []byte, fn func(dst, p []byte) []byte) *AccumulativeBuf
WriteApplyFn applies fn to p and write result to the buffer.
func (*AccumulativeBuf) WriteApplyFnStr ¶ added in v1.0.2
func (b *AccumulativeBuf) WriteApplyFnStr(s string, fn func(dst, p []byte) []byte) *AccumulativeBuf
WriteApplyFnStr applies fn to s and write result to the buffer.
func (*AccumulativeBuf) WriteBool ¶
func (b *AccumulativeBuf) WriteBool(v bool) *AccumulativeBuf
WriteBool writes boolean value to the buffer.
func (*AccumulativeBuf) WriteByte ¶
func (b *AccumulativeBuf) WriteByte(p byte) *AccumulativeBuf
WriteByte writes single byte.
func (*AccumulativeBuf) WriteFloat ¶
func (b *AccumulativeBuf) WriteFloat(f float64) *AccumulativeBuf
WriteFloat writes float value to the buffer.
func (*AccumulativeBuf) WriteInt ¶
func (b *AccumulativeBuf) WriteInt(i int64) *AccumulativeBuf
WriteInt writes integer value to the buffer.
func (*AccumulativeBuf) WriteMarshallerTo ¶
func (b *AccumulativeBuf) WriteMarshallerTo(m MarshallerTo) *AccumulativeBuf
WriteMarshallerTo marshal data of struct implemented MarshallerTo interface and write it to the buffer.
func (*AccumulativeBuf) WriteStr ¶
func (b *AccumulativeBuf) WriteStr(s string) *AccumulativeBuf
WriteStr writes string to the buffer.
func (*AccumulativeBuf) WriteUint ¶
func (b *AccumulativeBuf) WriteUint(u uint64) *AccumulativeBuf
WriteUint writes unsigned integer value to the buffer.
func (*AccumulativeBuf) WriteX ¶
func (b *AccumulativeBuf) WriteX(x interface{}) *AccumulativeBuf
WriteX write v with arbitrary type to the buffer.
type ChainBuf ¶
type ChainBuf []byte
ChainBuf is a primitive byte buffer with chain call support.
func (*ChainBuf) GrowDelta ¶
GrowDelta increases length of the buffer to actual length + delta.
See Grow().
func (*ChainBuf) ReplaceAll ¶
ReplaceAll replace all occurrences of old bytes to new in buffer.
func (*ChainBuf) ReplaceStr ¶
ReplaceStr replace old to new substrings in buffer.
func (*ChainBuf) ReplaceStrAll ¶
ReplaceStrAll replaces all occurrences of old substrings to new in buffer.
func (*ChainBuf) StringCopy ¶
StringCopy returns copy of the buffer contents as string.
func (*ChainBuf) WriteApplyFn ¶ added in v1.0.2
WriteApplyFn applies fn to p and write result to the buffer.
func (*ChainBuf) WriteApplyFnStr ¶ added in v1.0.2
WriteApplyFnStr applies fn to s and write result to the buffer.
func (*ChainBuf) WriteFloat ¶
WriteFloat writes float value to the buffer.
func (*ChainBuf) WriteMarshallerTo ¶
func (b *ChainBuf) WriteMarshallerTo(m MarshallerTo) *ChainBuf
WriteMarshallerTo marshal data of struct implemented MarshallerTo interface and write it to the buffer.