Documentation ¶
Index ¶
- func Dump(i interface{}, formatters ...KeyFormatterFunc) error
- func Fdump(w io.Writer, i interface{}, formatters ...KeyFormatterFunc) error
- func MustSdump(i interface{}, formatters ...KeyFormatterFunc) string
- func Sdump(i interface{}, formatters ...KeyFormatterFunc) (string, error)
- func ToMap(i interface{}, formatters ...KeyFormatterFunc) (map[string]interface{}, error)
- func ToStringMap(i interface{}, formatters ...KeyFormatterFunc) (map[string]string, error)
- type Encoder
- func (e *Encoder) Fdump(i interface{}) (err error)
- func (e *Encoder) Sdump(i interface{}) (string, error)
- func (e *Encoder) ToMap(i interface{}) (res map[string]interface{}, err error)
- func (e *Encoder) ToStringMap(i interface{}) (res map[string]string, err error)
- func (e *Encoder) ViperKey(s string) string
- type KeyFormatterFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dump ¶
func Dump(i interface{}, formatters ...KeyFormatterFunc) error
Dump displays the passed parameter properties to standard out such as complete types and all pointer addresses used to indirect to the final value. See Fdump if you would prefer dumping to an arbitrary io.Writer or Sdump to get the formatted result as a string.
func Fdump ¶
func Fdump(w io.Writer, i interface{}, formatters ...KeyFormatterFunc) error
Fdump formats and displays the passed arguments to io.Writer w. It formats exactly the same as Dump.
func MustSdump ¶
func MustSdump(i interface{}, formatters ...KeyFormatterFunc) string
MustSdump is a helper that wraps a call to a function returning (string, error) and panics if the error is non-nil.
func Sdump ¶
func Sdump(i interface{}, formatters ...KeyFormatterFunc) (string, error)
Sdump returns a string with the passed arguments formatted exactly the same as Dump.
func ToMap ¶
func ToMap(i interface{}, formatters ...KeyFormatterFunc) (map[string]interface{}, error)
ToMap dumps argument as a map[string]interface{}
func ToStringMap ¶
func ToStringMap(i interface{}, formatters ...KeyFormatterFunc) (map[string]string, error)
ToStringMap formats the argument as a map[string]string. It formats exactly the same as Dump.
Types ¶
type Encoder ¶
type Encoder struct { Formatters []KeyFormatterFunc ExtraFields struct { Len bool Type bool DetailedStruct bool DetailedMap bool DetailedArray bool DeepJSON bool UseJSONTag bool } ArrayJSONNotation bool Separator string DisableTypePrefix bool Prefix string // contains filtered or unexported fields }
Encoder ensures all options to dump an object
func NewDefaultEncoder ¶
func NewDefaultEncoder() *Encoder
NewDefaultEncoder instanciate a go-dump encoder
func NewEncoder ¶ added in v1.0.5
NewEncoder instanciate a go-dump encoder over the writer
func (*Encoder) Fdump ¶
Fdump formats and displays the passed arguments to io.Writer w. It formats exactly the same as Dump.
func (*Encoder) Sdump ¶
Sdump returns a string with the passed arguments formatted exactly the same as Dump.
func (*Encoder) ToStringMap ¶
ToStringMap formats the argument as a map[string]string. It formats exactly the same as Dump.
type KeyFormatterFunc ¶
KeyFormatterFunc is a type for key formatting
func NoFormatter ¶
func NoFormatter() KeyFormatterFunc
NoFormatter doesn't do anything, so to be sure to avoid keys formatting, use only this formatter
func WithDefaultFormatter ¶
func WithDefaultFormatter() KeyFormatterFunc
WithDefaultFormatter is the default formatter
func WithDefaultLowerCaseFormatter ¶
func WithDefaultLowerCaseFormatter() KeyFormatterFunc
WithDefaultLowerCaseFormatter formats keys in lowercase and apply default formatting
func WithDefaultUpperCaseFormatter ¶ added in v1.0.5
func WithDefaultUpperCaseFormatter() KeyFormatterFunc
WithDefaultUpperCaseFormatter formats keys in uppercase and apply default formatting
func WithLowerCaseFormatter ¶
func WithLowerCaseFormatter() KeyFormatterFunc
WithLowerCaseFormatter formats keys in lowercase