Versions in this module Expand all Collapse all v0 v0.0.2 Mar 25, 2024 v0.0.1 Mar 25, 2024 Changes in this version + var Base = New(map[string]Handler{ ... }) + var Default = Base.NewWith("json", "text", "yaml") + var Err = fmt.Errorf("render") + var ErrCannotRender = fmt.Errorf("%w: cannot render", Err) + var ErrFailed = fmt.Errorf("%w: failed", Err) + var ErrUnsupportedFormat = fmt.Errorf("%w: unsupported format", Err) + var JSONDefualtIndent = " " + var XMLDefualtIndent = " " + var YAMLDefaultIndent = 2 + func Compact(w io.Writer, format string, v any) error + func Pretty(w io.Writer, format string, v any) error + func Render(w io.Writer, format string, pretty bool, v any) error + type Binary struct + func (br *Binary) Formats() []string + func (br *Binary) Render(w io.Writer, v any) error + type FormatsHandler interface + Formats func() []string + type Handler interface + Render func(w io.Writer, v any) error + type JSON struct + Indent string + Prefix string + func (jr *JSON) Formats() []string + func (jr *JSON) Render(w io.Writer, v any) error + func (jr *JSON) RenderPretty(w io.Writer, v any) error + type Multi struct + Handlers []Handler + func (mr *Multi) Formats() []string + func (mr *Multi) Render(w io.Writer, v any) error + func (mr *Multi) RenderPretty(w io.Writer, v any) error + type PrettyHandler interface + RenderPretty func(w io.Writer, v any) error + type Renderer struct + Handlers map[string]Handler + func New(handlers map[string]Handler) *Renderer + func NewWith(formats ...string) *Renderer + func (r *Renderer) Add(format string, handler Handler) + func (r *Renderer) Compact(w io.Writer, format string, v any) error + func (r *Renderer) NewWith(formats ...string) *Renderer + func (r *Renderer) Pretty(w io.Writer, format string, v any) error + func (r *Renderer) Render(w io.Writer, format string, pretty bool, v any) error + type Text struct + func (t *Text) Formats() []string + func (t *Text) Render(w io.Writer, v any) error + type XML struct + Indent string + Prefix string + func (x *XML) Formats() []string + func (x *XML) Render(w io.Writer, v any) error + func (x *XML) RenderPretty(w io.Writer, v any) error + type YAML struct + Indent int + func (y *YAML) Formats() []string + func (y *YAML) Render(w io.Writer, v any) error