marsh

package module
v0.0.0-...-56cbb09 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinWrite

func BinWrite(w io.Writer, m encoding.BinaryMarshaler) error

BinWrite calls m.MarshalBinary() and writes the result to w.

func JSONWrite

func JSONWrite(w io.Writer, m json.Marshaler) error

JSONWrite calls m.MarshalJSON() and writes the result to w.

func TextWrite

func TextWrite(w io.Writer, m encoding.TextMarshaler) error

TextWrite calls m.MarshalText() and writes the result to w.

Types

type FullWriter

type FullWriter struct {
	W io.Writer
	// contains filtered or unexported fields
}

FullWriter is a utility type to couple with Marshal funcs.

func (*FullWriter) Close

func (fw *FullWriter) Close() error

Close will run Close on the underlying Writer if it is a WriteCloser.

func (*FullWriter) WriteBytes

func (fw *FullWriter) WriteBytes(b []byte, merr error) error

WriteBytes takes a buffer and an error, and writes it to the wrapped Writer inside of FullWriter. It's meant as a convenience, so you may call fw.WriteBytes(t.MarshalText())

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL