yagcl_json

package module
v0.0.0-...-ede7b53 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: Unlicense Imports: 12 Imported by: 0

README

YAGCL JSON

Go Reference Build and Tests codecov

This package provides a YAGCL source that provides access to reading JSON files.

Usage

go get github.com/Bios-Marcel/yagcl-json

Reporting Issues / Requesting features

All "official" sources for YAGCL should be reported in the main repositories issue section.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMultipleDataSourcesSpecified = errors.New("more than one data source specified; only call one of Bytes(), String(), Reader() or Path()")

ErrNoDataSourceSpecified is thrown if more than one of Bytes, String, Path or Reader of the JSONSourceSetupStepOne interface have been called.

View Source
var ErrNoDataSourceSpecified = errors.New("no data source specified; call Bytes(), String(), Reader() or Path()")

ErrNoDataSourceSpecified is thrown if none Bytes, String, Path or Reader of the JSONSourceSetupStepOne interface have been called.

Functions

This section is empty.

Types

type JSONSourceOptionalSetup

type JSONSourceOptionalSetup[T yagcl.Source] interface {
	yagcl.Source
	// Must declares this source as mandatory, erroring in case no data can
	// be loaded.
	// FIXME Clarify when this case happens. Only when not finding a file?
	// FIXME does must actually make sense for anything but files?
	Must() T
}

JSONSourceOptionalSetup offers optional Methods for configuring the source and exposes all methods required for a source to be passed on to YAGCL.

type JSONSourceSetupStepOne

type JSONSourceSetupStepOne[T yagcl.Source] interface {
	// Bytes defines a byte array to read from directly.
	Bytes([]byte) JSONSourceOptionalSetup[T]
	// Bytes defines a string to read from directly.
	String(string) JSONSourceOptionalSetup[T]
	// Path defines a filepath that is accessed when YAGCL.Parse is called.
	Path(string) JSONSourceOptionalSetup[T]
	// Reader defines a reader that is accessed when YAGCL.Parse is called. IF
	// available, io.Closer.Close() is called.
	Reader(io.Reader) JSONSourceOptionalSetup[T]
}

JSONSourceSetupStepOne enforces the API caller to specify any data source to read JSON encoded data from, before being able to pass the source on to YAGCL.

func Source

func Source() JSONSourceSetupStepOne[*jsonSourceImpl]

Source creates a source for a JSON file.

Jump to

Keyboard shortcuts

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