codecs

package
v0.0.0-...-548b26a Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: AGPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadObjectFromFile

func LoadObjectFromFile(filename string, object interface{}) (err error)

LoadObjectFromFile implements the common pattern for loading an instance of an object from a json file.

func NewFormattedJSONEncoder

func NewFormattedJSONEncoder(w io.Writer) *json.Encoder

NewFormattedJSONEncoder returns a json encoder configured for pretty-printed output (human-readable)

func SaveNonDefaultValuesToFile

func SaveNonDefaultValuesToFile(filename string, object, defaultObject interface{}, ignore []string) error

SaveNonDefaultValuesToFile saves an object to a file as json, but only fields that are not currently set to be the default value. Optionally, you can specify an array of field names to always include.

func SaveObjectToFile

func SaveObjectToFile(filename string, object interface{}, prettyFormat bool) error

SaveObjectToFile implements the common pattern for saving an object to a file as json

func WriteNonDefaultValues

func WriteNonDefaultValues(writer io.Writer, object, defaultObject interface{}, ignore []string) error

WriteNonDefaultValues writes object to a writer as json, but only fields that are not currently set to be the default value. Optionally, you can specify an array of field names to always include.

Types

This section is empty.

Jump to

Keyboard shortcuts

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