Documentation ¶
Overview ¶
Package jsonw implements output writers for JSON.
Index ¶
- func NewArrayRecordWriter(out io.Writer, pr *output.Printing) output.RecordWriter
- func NewConfigWriter(out io.Writer, pr *output.Printing) output.ConfigWriter
- func NewErrorWriter(log *slog.Logger, out io.Writer, pr *output.Printing) output.ErrorWriter
- func NewMetadataWriter(out io.Writer, pr *output.Printing) output.MetadataWriter
- func NewObjectRecordWriter(out io.Writer, pr *output.Printing) output.RecordWriter
- func NewPingWriter(out io.Writer, pr *output.Printing) output.PingWriter
- func NewSourceWriter(out io.Writer, pr *output.Printing) output.SourceWriter
- func NewStdRecordWriter(out io.Writer, pr *output.Printing) output.RecordWriter
- func NewVersionWriter(out io.Writer, pr *output.Printing) output.VersionWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewArrayRecordWriter ¶
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 NewConfigWriter ¶ added in v0.34.0
NewConfigWriter returns a new output.ConfigWriter.
func NewErrorWriter ¶
NewErrorWriter returns an output.ErrorWriter that outputs in JSON.
func NewMetadataWriter ¶
NewMetadataWriter returns a new output.MetadataWriter instance that outputs metadata in JSON.
func NewObjectRecordWriter ¶
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 NewPingWriter ¶ added in v0.24.0
NewPingWriter returns JSON impl of output.PingWriter.
func NewSourceWriter ¶ added in v0.23.0
NewSourceWriter returns a source writer that outputs source details in text table format.
func NewStdRecordWriter ¶
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" } ]
func NewVersionWriter ¶ added in v0.21.0
NewVersionWriter returns a new output.VersionWriter instance that outputs version info in JSON.
Types ¶
This section is empty.