json

package
v0.0.0-...-cd20b3e Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONReader

type JSONReader struct {
	// contains filtered or unexported fields
}

A JSONReader is a utility object to read JSON files and unmarshal it to Go structs.

func NewJSONReader

func NewJSONReader() *JSONReader

NewJSONReader returns the pointer to JSONReader.

func (JSONReader) Paths

func (j JSONReader) Paths() []string

Paths returns a path slice accumulated by Read() calls. Returned pathes is the string after the basename of prefixes. Resulting slices has no duplication even if multiple Read() calls with the same path.

func (*JSONReader) Read

func (j *JSONReader) Read(path, prefix string, v any) error

Read reads JSON file specified by path and umarhsal it to v. 3rd argument v MUST be of non-nil pointer type.

Jump to

Keyboard shortcuts

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