toml

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package toml provides an API for TOML serialization. This package wraps the BurntSushi toml package.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyInput = errors.New("empty input")
	// TOML cannot marshal nil values, because of a design decision.
	// https://github.com/toml-lang/toml/issues/30
	ErrNilObject = errors.New("nil object, toml cannot marshal nil values")
)
View Source
var (
	DefaultType = reflect.TypeOf(map[string]interface{}{})
)

Functions

func Marshal

func Marshal(obj interface{}) ([]byte, error)

Marshal formats an object into a slice of bytes of TOML.

func Unmarshal

func Unmarshal(b []byte) (interface{}, error)

Unmarshal parses a slice of bytes into a map[string]interface{} object This package is useful when your program needs to parse data, that you have no a priori awareness of its structure or type. If no input is given, then returns ErrEmptyInput.

func UnmarshalType

func UnmarshalType(b []byte, outputType reflect.Type) (interface{}, error)

UnmarshalType parses a slice of bytes into an object of a given type. If no input is given, then returns ErrEmptyInput.

Types

type ErrInvalidKind

type ErrInvalidKind struct {
	Value    reflect.Type
	Expected []reflect.Kind
}

func (ErrInvalidKind) Error

func (e ErrInvalidKind) Error() string

Jump to

Keyboard shortcuts

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