codecs

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2025 License: AGPL-3.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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