decoder

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: Apache-2.0 Imports: 1 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Filename  string // The filename (not full path) of the file being decoded.
	Delimiter string // The key delimiter string to use if needed.
}

Context is a way to pass additional information that the decoder may need access to in a more future proof way.

type Decoder

type Decoder interface {
	// Decode is called to decode a collection of bytes based on the formats
	// provided via the Extensions() function.  The filename is provided so it
	// can be included in the metadata about where the item came from.  The
	// keyDelimiter is provided in case the key needs to be split.
	//
	// A decoder should strive to provide as much information as it can about
	// where a value originated.  The filename, line number and column number
	// are very helpful when attempting to diagnose where a configuration
	// value originated from.
	Decode(ctx Context, b []byte, m *meta.Object) error

	// Extensions provides the list of extensions this decoder is able to decode.
	Extensions() []string
}

Decoder provides the decoder interface for goschtalt to use.

Jump to

Keyboard shortcuts

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