confformat

package
v0.0.0-...-b631e0d Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalAll

func MarshalAll() error

MarshalAll takes some data stored in structs and converts them to the various data formats

func OtherJSONExamples

func OtherJSONExamples() error

OtherJSONExamples shows ways to use types beyond structs and other useful functions

func UnmarshalAll

func UnmarshalAll() error

UnmarshalAll takes data in various formats and converts them into structs

Types

type JSONData

type JSONData struct {
	Name string `json:"name"`
	Age  int    `json:"age"`
}

JSONData is our common data struct with JSON struct tags

func (*JSONData) Decode

func (t *JSONData) Decode(data []byte) error

Decode will decode into JSONData

func (*JSONData) ToJSON

func (t *JSONData) ToJSON() (*bytes.Buffer, error)

ToJSON dumps the JSONData struct to a JSON format bytes.Buffer

type TOMLData

type TOMLData struct {
	Name string `toml:"name"`
	Age  int    `toml:"age"`
}

TOMLData is our common data struct with TOML struct tags

func (*TOMLData) Decode

func (t *TOMLData) Decode(data []byte) (toml.MetaData, error)

Decode will decode into TOMLData

func (*TOMLData) ToTOML

func (t *TOMLData) ToTOML() (*bytes.Buffer, error)

ToTOML dumps the TOMLData struct to a TOML format bytes.Buffer

type YAMLData

type YAMLData struct {
	Name string `yaml:"name"`
	Age  int    `yaml:"age"`
}

YAMLData is our common data struct with YAML struct tags

func (*YAMLData) Decode

func (t *YAMLData) Decode(data []byte) error

Decode will decode into TOMLData

func (*YAMLData) ToYAML

func (t *YAMLData) ToYAML() (*bytes.Buffer, error)

ToYAML dumps the YAMLData struct to a YAML format bytes.Buffer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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