Documentation
¶
Overview ¶
iojson are utilities for reading and writing JSON IO from a command line interface perspective
Index ¶
- func MarshalError(msg string, data map[string]any) string
- func Write(obj any, opts ...Option) error
- func WriteError(str string, data map[string]any) error
- func WriteLine(w io.Writer, obj any) error
- func WriteWith(w io.Writer, ew io.Writer, obj any, opts ...Option) error
- type Error
- type FileReader
- type Option
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalError ¶
MarshalError is a utility for creating an error struct, it will first attempt the marshal the struct, if that fails it will return return a manually constructed JSON blob with the provided error msg and a note that there was a marashling error and the this indicates a bug in the software.
Types ¶
type FileReader ¶
type FileReader[T any] struct { // contains filtered or unexported fields }
func (*FileReader[T]) Flag ¶
func (fr *FileReader[T]) Flag() *cli.StringFlag
func (*FileReader[T]) Read ¶
func (fr *FileReader[T]) Read() (T, error)
type Option ¶
type Option func(*Options)
Option is a functional option for configuring JSON output.
func WithIndent ¶
WithIndent sets whether to indent JSON output (default: true).
Click to show internal directories.
Click to hide internal directories.