yaml

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2022 License: MIT Imports: 3 Imported by: 0

README

UTIL/YAML

yaml is utilities for the YAML files. This package implementing core functions from gopkg.in/yaml.v3. This package also has some additional I/O features such as YAML writer and YAML reader.

See Documentation

IMPORT

  • Package
import "github.com/bearaujus/bgdk/util/yaml"
  • Mock
import "github.com/bearaujus/bgdk/util/yaml/mock"

 

Back to top

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitTestMode

func InitTestMode(mockInstance *mock.MockYAML)

InitTestMode will set the YAML instance to mockInstance.

Note: this function for testing purposes only. After executing InitTestMode, whenever your unit tests execute Instance it will call mockInstance.

Types

type YAML added in v1.0.1

type YAML interface {
	// Marshal is used to encode the data from v.
	//
	// Note: v can be a struct or a ptr struct (*struct).
	Marshal(v interface{}) ([]byte, error)

	// MarshalWrite is used to encode data from v and write the encoded data to destPath.
	//
	// Note: v can be a struct or a ptr struct (*struct).
	MarshalWrite(destPath string, v interface{}) error

	// Unmarshal is used to store the encoded data to v.
	//
	// Note: v must be a ptr struct (*struct).
	Unmarshal(data []byte, v interface{}) error

	// UnmarshalRead is used to read the encoded data from srcPath and store the encoded data to v.
	//
	// Note: v must be a ptr struct (*struct).
	UnmarshalRead(srcPath string, v interface{}) error
}

YAML is an interface primarily used by Instance.

func Instance

func Instance() YAML

Instance will return the YAML interface.

Note: first time calling this function will create a new instance to implement the YAML interface (except if you call InitTestMode). The next time this function is called, it will use the previously created instance.

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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