Documentation ¶
Overview ¶
Package jsonw implements output writers for JSON.
Index ¶
- func NewArrayRecordWriter(out io.Writer, fm *output.Formatting) output.RecordWriter
- func NewErrorWriter(log lg.Log, out io.Writer, fm *output.Formatting) output.ErrorWriter
- func NewMetadataWriter(out io.Writer, fm *output.Formatting) output.MetadataWriter
- func NewObjectRecordWriter(out io.Writer, fm *output.Formatting) output.RecordWriter
- func NewStdRecordWriter(out io.Writer, fm *output.Formatting) output.RecordWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewArrayRecordWriter ¶
func NewArrayRecordWriter(out io.Writer, fm *output.Formatting) output.RecordWriter
NewArrayRecordWriter returns a RecordWriter that outputs each record as a JSON array on its own line. For example:
[1, "PENELOPE", "GUINESS", "2020-06-11T02:50:54Z"] [2, "NICK", "WAHLBERG", "2020-06-11T02:50:54Z"]
func NewErrorWriter ¶
func NewErrorWriter(log lg.Log, out io.Writer, fm *output.Formatting) output.ErrorWriter
NewErrorWriter returns an output.ErrorWriter that outputs in JSON.
func NewMetadataWriter ¶
func NewMetadataWriter(out io.Writer, fm *output.Formatting) output.MetadataWriter
NewMetadataWriter returns a new output.MetadataWriter instance that outputs metadata in JSON.
func NewObjectRecordWriter ¶
func NewObjectRecordWriter(out io.Writer, fm *output.Formatting) output.RecordWriter
NewObjectRecordWriter writes out each record as a JSON object on its own line. For example:
{"actor_id": 1, "first_name": "PENELOPE", "last_name": "GUINESS", "last_update": "2020-06-11T02:50:54Z"} {"actor_id": 2, "first_name": "NICK", "last_name": "WAHLBERG", "last_update": "2020-06-11T02:50:54Z"}
func NewStdRecordWriter ¶
func NewStdRecordWriter(out io.Writer, fm *output.Formatting) output.RecordWriter
NewStdRecordWriter returns a record writer that outputs each record as a JSON object that is an element of JSON array. This is to say, standard JSON. For example:
[ { "actor_id": 1, "first_name": "PENELOPE", "last_name": "GUINESS", "last_update": "2020-06-11T02:50:54Z" }, { "actor_id": 2, "first_name": "NICK", "last_name": "WAHLBERG", "last_update": "2020-06-11T02:50:54Z" } ]
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.