Documentation ¶
Index ¶
- type Buffer
- func (b *Buffer) Break() *Buffer
- func (b Buffer) Bytes() []byte
- func (b Buffer) BytesCopy() []byte
- func (b Buffer) Cap() int
- func (b *Buffer) Else() *Buffer
- func (b *Buffer) ElseIf(cond bool) *Buffer
- func (b *Buffer) EndIf() *Buffer
- func (b *Buffer) For(start, end, step int, do func(b *Buffer, i int)) *Buffer
- func (b *Buffer) ForNTimes(n int, do func(b *Buffer, i int)) *Buffer
- func (b *Buffer) If(cond bool) *Buffer
- func (b Buffer) Len() int
- func (b Buffer) ReadCloser() io.ReadCloser
- func (b Buffer) Reader() io.Reader
- func (b *Buffer) Reset()
- func (b Buffer) String() string
- func (b *Buffer) Write(data []byte) (int, error)
- func (b *Buffer) WriteAny(v any) *Buffer
- func (b *Buffer) WriteBool(v bool) *Buffer
- func (b *Buffer) WriteByte(c byte) *Buffer
- func (b *Buffer) WriteBytes(s []byte) *Buffer
- func (b *Buffer) WriteDuration(d time.Duration) *Buffer
- func (b *Buffer) WriteFloat32(f float32, format byte, precision int) *Buffer
- func (b *Buffer) WriteFloat64(f float64, format byte, precision int) *Buffer
- func (b *Buffer) WriteFromBufferWriter(w BufferWriter) *Buffer
- func (b *Buffer) WriteInt(i int) *Buffer
- func (b *Buffer) WriteInt16(i int16) *Buffer
- func (b *Buffer) WriteInt32(i int32) *Buffer
- func (b *Buffer) WriteInt64(i int64) *Buffer
- func (b *Buffer) WriteInt8(i int8) *Buffer
- func (b *Buffer) WriteJsonSafeBytes(s []byte) *Buffer
- func (b *Buffer) WriteJsonSafeString(s string) *Buffer
- func (b *Buffer) WritePointer(p uintptr) *Buffer
- func (b *Buffer) WriteRune(r rune) *Buffer
- func (b *Buffer) WriteString(s string) *Buffer
- func (b *Buffer) WriteTime(t time.Time, format string) *Buffer
- func (b *Buffer) WriteUint(i uint) *Buffer
- func (b *Buffer) WriteUint16(i uint16) *Buffer
- func (b *Buffer) WriteUint32(i uint32) *Buffer
- func (b *Buffer) WriteUint64(i uint64) *Buffer
- func (b *Buffer) WriteUint8(i uint8) *Buffer
- type BufferWriteFunc
- type BufferWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
func (*Buffer) Break ¶
Break breaks the for loop; DO NOT use this outside of For, or it may cause panic.
func (Buffer) Bytes ¶
Bytes returns b.data. It is NOT a copy, so the result will be changed after b modified.
func (*Buffer) For ¶
For starts a for loop with the given start, end and step. Function do will be called for each step.
func (*Buffer) ForNTimes ¶
ForNTimes is a shortcut of For(0, n, 1, do); i would be 0, 1, 2, ..., n-1.
func (Buffer) ReadCloser ¶
func (b Buffer) ReadCloser() io.ReadCloser
ReadCloser creates an io.ReadCloser, but Close does nothing.
func (*Buffer) Write ¶
Write implements io.Writer, and it will write data to buffer directly, without considering any conditions. If you need chaining call, use WriteBytes instead.
func (*Buffer) WriteAny ¶
WriteAny writes any value to the buffer. DO NOT write byte or rune value with this if you want its ASCII representation. Use WriteByte or WriteRune instead.
func (*Buffer) WriteBytes ¶
func (*Buffer) WriteFloat32 ¶
func (*Buffer) WriteFloat64 ¶
func (*Buffer) WriteFromBufferWriter ¶
func (b *Buffer) WriteFromBufferWriter(w BufferWriter) *Buffer
func (*Buffer) WriteInt16 ¶
func (*Buffer) WriteInt32 ¶
func (*Buffer) WriteInt64 ¶
func (*Buffer) WriteJsonSafeBytes ¶
func (*Buffer) WriteJsonSafeString ¶
func (*Buffer) WritePointer ¶
WritePointer appends the hexadecimal address of p with a "0x" prefix. uintptr is like uint, its bitsize depends on the operating system.
func (*Buffer) WriteString ¶
func (*Buffer) WriteUint16 ¶
func (*Buffer) WriteUint32 ¶
func (*Buffer) WriteUint64 ¶
func (*Buffer) WriteUint8 ¶
type BufferWriteFunc ¶
type BufferWriteFunc func(b *Buffer)
func (BufferWriteFunc) WriteTo ¶
func (fn BufferWriteFunc) WriteTo(b *Buffer)
type BufferWriter ¶
type BufferWriter interface {
WriteTo(b *Buffer)
}