format

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const DIRECTORY_WRITE_PERMISSIONS = 0700
View Source
const FILE_WRITE_PERMISSIONS = 0600

Variables

View Source
var XMLKeyStart = xml.StartElement{Name: xml.Name{Local: "key"}}
View Source
var XMLMapEntryStart = xml.StartElement{Name: xml.Name{Local: "entry"}}
View Source
var XMLMapStartElement = xml.StartElement{Name: xml.Name{Local: "map"}}
View Source
var XMLValueStart = xml.StartElement{Name: xml.Name{Local: "value"}}
View Source
var YAMLNodeKinds = map[yaml.Kind]string{
	yaml.DocumentNode: "Document",
	yaml.SequenceNode: "Sequence",
	yaml.MappingNode:  "Mapping",
	yaml.ScalarNode:   "Scalar",
	yaml.AliasNode:    "Alias",
}

Functions

func Decode

func Decode(code string, format string, all bool) (ard.Value, error)

func DecodeAllYAML

func DecodeAllYAML(code string) (ard.List, error)

func DecodeCompatibleJSON added in v0.1.15

func DecodeCompatibleJSON(code string) (ard.Value, error)

func DecodeJSON

func DecodeJSON(code string) (ard.Value, error)

func DecodeYAML

func DecodeYAML(code string) (ard.Value, error)

func DecodeYAMLStringMaps

func DecodeYAMLStringMaps(code string) ([]ard.StringMap, error)

func DecodeYAMLTemplate

func DecodeYAMLTemplate(code string, data interface{}) (ard.StringMap, error)

func Encode

func Encode(data interface{}, format string, strict bool) (string, error)

func EncodeCompatibleJSON added in v0.1.15

func EncodeCompatibleJSON(data interface{}, indent string) (string, error)

func EncodeJSON

func EncodeJSON(data interface{}, indent string) (string, error)

func EncodeXML

func EncodeXML(data interface{}, indent string) (string, error)

func EncodeYAML

func EncodeYAML(data interface{}, indent string, strict bool) (string, error)

func Normalize

func Normalize(data interface{}) (interface{}, error)

func OpenFileForWrite

func OpenFileForWrite(path string) (*os.File, error)

func Print

func Print(data interface{}, format string, writer io.Writer, strict bool, pretty bool) error

func PrintCompatibleJSON added in v0.1.15

func PrintCompatibleJSON(data interface{}, writer io.Writer, pretty bool) error

func PrintJSON

func PrintJSON(data interface{}, writer io.Writer, pretty bool) error

func PrintXML

func PrintXML(data interface{}, writer io.Writer, pretty bool) error

func PrintXMLDocument

func PrintXMLDocument(xmlDocument *etree.Document, writer io.Writer, pretty bool) error

func PrintYAML

func PrintYAML(data interface{}, writer io.Writer, strict bool, pretty bool) error

func Read

func Read(reader io.Reader, format string) (ard.Value, error)

func ReadAllYAML

func ReadAllYAML(reader io.Reader) (ard.List, error)

func ReadCompatibleJSON added in v0.1.15

func ReadCompatibleJSON(reader io.Reader) (ard.Value, error)

func ReadJSON

func ReadJSON(reader io.Reader) (ard.Value, error)

func ReadYAML

func ReadYAML(reader io.Reader) (ard.Value, error)

func ToCompatibleJSON added in v0.1.15

func ToCompatibleJSON(value ard.Value) ard.Value

func ToXMLWritable

func ToXMLWritable(data interface{}) interface{}

func Validate

func Validate(code string, format string) error

func ValidateJSON

func ValidateJSON(code string) error

func ValidateXML

func ValidateXML(code string) error

func ValidateYAML

func ValidateYAML(code string) error

func Write

func Write(data interface{}, format string, indent string, strict bool, writer io.Writer) error

func WriteCompatibleJSON added in v0.1.15

func WriteCompatibleJSON(data interface{}, writer io.Writer, indent string) error

func WriteJSON

func WriteJSON(data interface{}, writer io.Writer, indent string) error

func WriteOrPrint

func WriteOrPrint(data interface{}, format string, writer io.Writer, strict bool, pretty bool, output string) error

func WriteXML

func WriteXML(data interface{}, writer io.Writer, indent string) error

func WriteXMLDocument

func WriteXMLDocument(xmlDocument *etree.Document, writer io.Writer, indent string) error

func WriteYAML

func WriteYAML(data interface{}, writer io.Writer, indent string, strict bool) error

func WriteYAMLNode

func WriteYAMLNode(writer io.Writer, node *yaml.Node, indent int)

func WriteYAMLNodes

func WriteYAMLNodes(writer io.Writer, node *yaml.Node)

Types

type XMLMap

type XMLMap struct {
	Entries []XMLMapEntry
}

func (XMLMap) MarshalXML

func (self XMLMap) MarshalXML(encoder *xml.Encoder, start xml.StartElement) error

xml.Marshaler interface

type XMLMapEntry

type XMLMapEntry struct {
	Key   interface{}
	Value interface{}
}

func (XMLMapEntry) MarshalXML

func (self XMLMapEntry) MarshalXML(encoder *xml.Encoder, start xml.StartElement) error

xml.Marshaler interface

Jump to

Keyboard shortcuts

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