xson

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

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

Go to latest
Published: Oct 29, 2016 License: MIT Imports: 8 Imported by: 1

README

xson

Universal marshaller. Currently supports yaml, xml and json.

GoDoc Build Status

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UnknownTypeError  = errors.New("Unknown type")
	NotSupportedError = errors.New("Not supported function")
)

Functions

func GetExtensions

func GetExtensions(t Type) []string

func Marshal

func Marshal(t Type, v interface{}) ([]byte, error)

func MarshalIndent

func MarshalIndent(t Type, v interface{}, prefix, indent string) ([]byte, error)

func Unmarshal

func Unmarshal(t Type, data []byte, v interface{}) error

Types

type Marshaller

type Marshaller struct {
	Marshal       func(v interface{}) ([]byte, error)
	MarshalIndent func(v interface{}, prefix, indent string) ([]byte, error)
	Unmarshal     func(data []byte, v interface{}) error
	Extesions     []string
}

type Type

type Type int
const (
	UNKNOWN Type = 1 + iota
	JSON
	YAML
	XML
	TOML
	FLAT_JSON
	FLAT_YAML
)

func GetType

func GetType(filenameOrExtension string) Type

func GetTypes

func GetTypes() []Type

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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