Documentation ¶
Index ¶
- type AsyncBuffer
- func (ab *AsyncBuffer) Bytes() []byte
- func (ab *AsyncBuffer) Len() int
- func (ab *AsyncBuffer) ReadAll() []byte
- func (ab *AsyncBuffer) ReadAllString() string
- func (ab *AsyncBuffer) ReadBytes(delim byte) ([]byte, error)
- func (ab *AsyncBuffer) ReadString(delim byte) (string, error)
- func (ab *AsyncBuffer) Reset()
- func (ab *AsyncBuffer) String() string
- func (ab *AsyncBuffer) Truncate(n int)
- func (ab *AsyncBuffer) Write(p []byte) (int, error)
- type AsyncBuilder
- func (sb *AsyncBuilder) Grow(n int)
- func (sb *AsyncBuilder) Len() int
- func (sb *AsyncBuilder) ReadAll() string
- func (sb *AsyncBuilder) Reset()
- func (sb *AsyncBuilder) String() string
- func (sb *AsyncBuilder) Write(p []byte) (int, error)
- func (sb *AsyncBuilder) WriteByte(c byte) error
- func (sb *AsyncBuilder) WriteRune(r rune) (int, error)
- func (sb *AsyncBuilder) WriteString(s string) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncBuffer ¶
type AsyncBuffer struct {
// contains filtered or unexported fields
}
AsyncBuffer is like bytes.Buffer but it can safely be used from multiple goroutines at once. But it does not implement every bytes.Buffer method. It adds ReadAll() and ReadAllString() methods for atomic operations. It is useful as a logging destination inside of automated tests.
'new(buffer.AsyncBuffer)' should be used to create an AsyncBuffer. You can also just declare a buffer.AsyncBuffer so long as you are careful to never make a copy of it.
func (*AsyncBuffer) Bytes ¶
func (ab *AsyncBuffer) Bytes() []byte
func (*AsyncBuffer) Len ¶
func (ab *AsyncBuffer) Len() int
func (*AsyncBuffer) ReadAll ¶
func (ab *AsyncBuffer) ReadAll() []byte
ReadAll() is similar to Bytes() except it also atomically Reset()s the buffer and the returned slice is a copy that is not changed by subsequent buffer operations.
func (*AsyncBuffer) ReadAllString ¶
func (ab *AsyncBuffer) ReadAllString() string
ReadAllString() is similar to String() except it also atomically Reset()s the buffer.
func (*AsyncBuffer) ReadString ¶
func (ab *AsyncBuffer) ReadString(delim byte) (string, error)
func (*AsyncBuffer) Reset ¶
func (ab *AsyncBuffer) Reset()
func (*AsyncBuffer) String ¶
func (ab *AsyncBuffer) String() string
func (*AsyncBuffer) Truncate ¶
func (ab *AsyncBuffer) Truncate(n int)
type AsyncBuilder ¶
type AsyncBuilder struct {
// contains filtered or unexported fields
}
AsyncBuilder is like strings.Builder but it can safely be used from multiple goroutines at once. It is useful as a logging destination inside of automated tests if you only ever want the entire recent log contents [since the last Reset()] as a single string.
'new(buffer.AsyncBuilder)' should be used to create an AsyncBuilder. You can also just declare a buffer.AsyncBuilder so long as you are careful to never make a copy of it.
func (*AsyncBuilder) Grow ¶
func (sb *AsyncBuilder) Grow(n int)
func (*AsyncBuilder) Len ¶
func (sb *AsyncBuilder) Len() int
func (*AsyncBuilder) ReadAll ¶
func (sb *AsyncBuilder) ReadAll() string
ReadAll() is like String() but it also atomically Reset()s the builder.
func (*AsyncBuilder) Reset ¶
func (sb *AsyncBuilder) Reset()
func (*AsyncBuilder) String ¶
func (sb *AsyncBuilder) String() string
func (*AsyncBuilder) WriteByte ¶
func (sb *AsyncBuilder) WriteByte(c byte) error
func (*AsyncBuilder) WriteString ¶
func (sb *AsyncBuilder) WriteString(s string) (int, error)