Documentation ¶
Index ¶
- func Append(buf *Buffer, v ...interface{})
- func Appendf(buf *Buffer, s string, a ...interface{})
- func Fprint(w io.Writer, v ...interface{}) (int, error)
- func Fprintf(w io.Writer, s string, a ...interface{}) (int, error)
- func Fprintln(w io.Writer, v ...interface{}) (int, error)
- func Print(v ...interface{})
- func Printf(s string, a ...interface{})
- func Println(v ...interface{})
- func Sprint(v ...interface{}) string
- func Sprintf(s string, a ...interface{}) string
- type Buffer
- func (buf *Buffer) Append(b []byte)
- func (buf *Buffer) AppendByte(b byte)
- func (buf *Buffer) AppendRune(r rune)
- func (buf *Buffer) AppendString(s string)
- func (buf *Buffer) Cap() int
- func (buf *Buffer) Len() int
- func (buf *Buffer) Reset()
- func (buf *Buffer) String() string
- func (buf *Buffer) Truncate(n int)
- type Formattable
- type Formatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Append ¶
func Append(buf *Buffer, v ...interface{})
Append will append formatted form of supplied values into 'buf' using default formatter.
func Appendf ¶
Appendf will append the formatted string with supplied values into 'buf' using default formatter. Supported format directives: - '%v' => format supplied arg, in place - '%#v' => format supplied arg verbosely, in place
To include a non-directive '%' character escape it with an additional '%'.
More formatting directives might be included in the future.
func Fprintf ¶
Fprintf will format supplied format string and args, writing this to an io.Writer. See documentation for Formatter.Appendf(...) for format string usage.
func Fprintln ¶
Println will format supplied values, append a trailing newline and writer this to an io.Writer.
func Print ¶
func Print(v ...interface{})
Print will format supplied values, print this to os.Stdout.
func Printf ¶
func Printf(s string, a ...interface{})
Printf will format supplied format string and args, printing this to os.Stdout. See documentation for Formatter.Appendf(...) for format string usage.
func Println ¶
func Println(v ...interface{})
Println will format supplied values, append a trailing newline and print this to os.Stdout.
Types ¶
type Buffer ¶
type Buffer struct {
B []byte
}
Buffer is a simple wrapper around a byte slice.
func (*Buffer) AppendByte ¶
AppendByte appends given byte to the buffer.
func (*Buffer) AppendRune ¶
AppendRune appends given rune to the buffer.
func (*Buffer) AppendString ¶
AppendString appends given string to the buffer.
func (*Buffer) Reset ¶
func (buf *Buffer) Reset()
Reset will reset the buffer length to 0 (retains capacity).
type Formattable ¶
Formattable defines a type capable of being formatted and appended to a byte buffer.
type Formatter ¶
type Formatter struct { // MaxDepth specifies the max depth of fields the formatter will iterate. // Once max depth is reached, value will simply be formatted as "...". // e.g. // // MaxDepth=1 // type A struct{ // Nested B // } // type B struct{ // Nested C // } // type C struct{ // Field string // } // // Append(&buf, A{}) => {Nested={Nested={Field=...}}} MaxDepth uint8 }
Formatter allows configuring value and string formatting.
func (Formatter) Appendf ¶
Appendf will append the formatted string with supplied values into 'buf'. Supported format directives: - '%v' => format supplied arg, in place - '%#v' => format supplied arg verbosely, in place
To include a non-directive '%' character escape it with an additional '%'.
More formatting directives might be included in the future.