yamlmeta

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewASTFromInterface

func NewASTFromInterface(val interface{}) interface{}

func NewInterfaceFromAST added in v0.15.0

func NewInterfaceFromAST(val interface{}) interface{}

func PlainUnmarshal

func PlainUnmarshal(data []byte, out interface{}) error

Types

type Array

type Array struct {
	Metas    []*Meta
	Items    []*ArrayItem
	Position *filepos.Position
	// contains filtered or unexported fields
}

func (*Array) AddValue

func (n *Array) AddValue(val interface{}) error

func (*Array) DeepCopy

func (n *Array) DeepCopy() *Array

func (*Array) DeepCopyAsInterface

func (n *Array) DeepCopyAsInterface() interface{}

func (*Array) DeepCopyAsNode

func (n *Array) DeepCopyAsNode() Node

func (*Array) GetAnnotations

func (n *Array) GetAnnotations() interface{}

func (*Array) GetMetas

func (n *Array) GetMetas() []*Meta

func (*Array) GetPosition

func (n *Array) GetPosition() *filepos.Position

func (*Array) GetValues

func (n *Array) GetValues() []interface{}

func (*Array) MarshalJSON added in v0.15.0

func (n *Array) MarshalJSON() ([]byte, error)

func (*Array) MarshalYAML

func (n *Array) MarshalYAML() (interface{}, error)

func (*Array) ResetValue

func (n *Array) ResetValue()

func (*Array) SetAnnotations

func (n *Array) SetAnnotations(anns interface{})

func (*Array) SetValue

func (n *Array) SetValue(val interface{}) error

type ArrayItem

type ArrayItem struct {
	Metas    []*Meta
	Value    interface{}
	Position *filepos.Position
	// contains filtered or unexported fields
}

func (*ArrayItem) AddValue

func (n *ArrayItem) AddValue(val interface{}) error

func (*ArrayItem) DeepCopy

func (n *ArrayItem) DeepCopy() *ArrayItem

func (*ArrayItem) DeepCopyAsInterface

func (n *ArrayItem) DeepCopyAsInterface() interface{}

func (*ArrayItem) DeepCopyAsNode

func (n *ArrayItem) DeepCopyAsNode() Node

func (*ArrayItem) GetAnnotations

func (n *ArrayItem) GetAnnotations() interface{}

func (*ArrayItem) GetMetas

func (n *ArrayItem) GetMetas() []*Meta

func (*ArrayItem) GetPosition

func (n *ArrayItem) GetPosition() *filepos.Position

func (*ArrayItem) GetValues

func (n *ArrayItem) GetValues() []interface{}

func (*ArrayItem) MarshalJSON added in v0.15.0

func (n *ArrayItem) MarshalJSON() ([]byte, error)

func (*ArrayItem) MarshalYAML

func (n *ArrayItem) MarshalYAML() (interface{}, error)

func (*ArrayItem) ResetValue

func (n *ArrayItem) ResetValue()

func (*ArrayItem) SetAnnotations

func (n *ArrayItem) SetAnnotations(anns interface{})

func (*ArrayItem) SetValue

func (n *ArrayItem) SetValue(val interface{}) error

type DocSetOpts added in v0.4.0

type DocSetOpts struct {
	WithoutMeta bool
	// associatedName is typically a file name where data came from
	AssociatedName string
}

type Document

type Document struct {
	Metas    []*Meta
	Value    interface{}
	Position *filepos.Position
	// contains filtered or unexported fields
}

func (*Document) AddValue

func (n *Document) AddValue(val interface{}) error

func (*Document) AsInterface

func (d *Document) AsInterface(opts InterfaceConvertOpts) interface{}

func (*Document) DeepCopy

func (n *Document) DeepCopy() *Document

func (*Document) DeepCopyAsInterface

func (n *Document) DeepCopyAsInterface() interface{}

func (*Document) DeepCopyAsNode

func (n *Document) DeepCopyAsNode() Node

func (*Document) GetAnnotations

func (n *Document) GetAnnotations() interface{}

func (*Document) GetMetas

func (n *Document) GetMetas() []*Meta

func (*Document) GetPosition

func (n *Document) GetPosition() *filepos.Position

func (*Document) GetValues

func (n *Document) GetValues() []interface{}

func (*Document) IsEmpty

func (d *Document) IsEmpty() bool

func (*Document) MarshalJSON added in v0.15.0

func (n *Document) MarshalJSON() ([]byte, error)

func (*Document) MarshalYAML

func (n *Document) MarshalYAML() (interface{}, error)

func (*Document) ResetValue

func (n *Document) ResetValue()

func (*Document) SetAnnotations

func (n *Document) SetAnnotations(anns interface{})

func (*Document) SetValue

func (n *Document) SetValue(val interface{}) error

type DocumentPrinter added in v0.14.0

type DocumentPrinter interface {
	Print(*Document) error
}

type DocumentSet

type DocumentSet struct {
	Metas    []*Meta
	AllMetas []*Meta

	Items    []*Document
	Position *filepos.Position
	// contains filtered or unexported fields
}

func NewDocumentSetFromBytes

func NewDocumentSetFromBytes(data []byte, associatedName string) (*DocumentSet, error)

func NewDocumentSetFromBytesWithOpts added in v0.4.0

func NewDocumentSetFromBytesWithOpts(data []byte, opts DocSetOpts) (*DocumentSet, error)

func (*DocumentSet) AddValue

func (n *DocumentSet) AddValue(val interface{}) error

func (*DocumentSet) AsBytes

func (d *DocumentSet) AsBytes() ([]byte, error)

func (*DocumentSet) AsBytesWithPrinter added in v0.14.0

func (d *DocumentSet) AsBytesWithPrinter(printerFunc func(io.Writer) DocumentPrinter) ([]byte, error)

func (*DocumentSet) AsSourceBytes

func (d *DocumentSet) AsSourceBytes() ([]byte, bool)

AsSourceBytes() returns bytes used to make original DocumentSet. Any changes made to the DocumentSet are not reflected in any way

func (*DocumentSet) DeepCopy

func (n *DocumentSet) DeepCopy() *DocumentSet

func (*DocumentSet) DeepCopyAsInterface

func (n *DocumentSet) DeepCopyAsInterface() interface{}

func (*DocumentSet) DeepCopyAsNode

func (n *DocumentSet) DeepCopyAsNode() Node

func (*DocumentSet) GetAnnotations

func (n *DocumentSet) GetAnnotations() interface{}

func (*DocumentSet) GetMetas

func (n *DocumentSet) GetMetas() []*Meta

func (*DocumentSet) GetPosition

func (n *DocumentSet) GetPosition() *filepos.Position

func (*DocumentSet) GetValues

func (n *DocumentSet) GetValues() []interface{}

func (*DocumentSet) MarshalJSON added in v0.15.0

func (n *DocumentSet) MarshalJSON() ([]byte, error)

func (*DocumentSet) MarshalYAML

func (n *DocumentSet) MarshalYAML() (interface{}, error)

func (*DocumentSet) Print

func (d *DocumentSet) Print(writer io.Writer)

func (*DocumentSet) ResetValue

func (n *DocumentSet) ResetValue()

func (*DocumentSet) SetAnnotations

func (n *DocumentSet) SetAnnotations(anns interface{})

func (*DocumentSet) SetValue

func (n *DocumentSet) SetValue(val interface{}) error

type FilePositionPrinter added in v0.14.0

type FilePositionPrinter struct {
	// contains filtered or unexported fields
}

func NewFilePositionPrinter added in v0.14.0

func NewFilePositionPrinter(writer io.Writer) *FilePositionPrinter

func NewFilePositionPrinterWithOpts added in v0.14.0

func NewFilePositionPrinterWithOpts(writer io.Writer, opts FilePositionPrinterOpts) *FilePositionPrinter

func (*FilePositionPrinter) Print added in v0.14.0

func (p *FilePositionPrinter) Print(val interface{})

func (*FilePositionPrinter) PrintStr added in v0.14.0

func (p *FilePositionPrinter) PrintStr(val interface{}) string

type FilePositionPrinterOpts added in v0.14.0

type FilePositionPrinterOpts struct{}

type InterfaceConvertOpts

type InterfaceConvertOpts struct {
	OrderedMap bool
	Plain      bool
}

type JSONPrinter added in v0.14.0

type JSONPrinter struct {
	// contains filtered or unexported fields
}

func NewJSONPrinter added in v0.14.0

func NewJSONPrinter(writer io.Writer) JSONPrinter

func (JSONPrinter) Print added in v0.14.0

func (p JSONPrinter) Print(item *Document) error

type Map

type Map struct {
	Metas    []*Meta
	Items    []*MapItem
	Position *filepos.Position
	// contains filtered or unexported fields
}

func (*Map) AddValue

func (n *Map) AddValue(val interface{}) error

func (*Map) DeepCopy

func (n *Map) DeepCopy() *Map

func (*Map) DeepCopyAsInterface

func (n *Map) DeepCopyAsInterface() interface{}

func (*Map) DeepCopyAsNode

func (n *Map) DeepCopyAsNode() Node

func (*Map) GetAnnotations

func (n *Map) GetAnnotations() interface{}

func (*Map) GetMetas

func (n *Map) GetMetas() []*Meta

func (*Map) GetPosition

func (n *Map) GetPosition() *filepos.Position

func (*Map) GetValues

func (n *Map) GetValues() []interface{}

func (*Map) MarshalJSON added in v0.15.0

func (n *Map) MarshalJSON() ([]byte, error)

func (*Map) MarshalYAML

func (n *Map) MarshalYAML() (interface{}, error)

func (*Map) ResetValue

func (n *Map) ResetValue()

func (*Map) SetAnnotations

func (n *Map) SetAnnotations(anns interface{})

func (*Map) SetValue

func (n *Map) SetValue(val interface{}) error

type MapItem

type MapItem struct {
	Metas    []*Meta
	Key      interface{}
	Value    interface{}
	Position *filepos.Position
	// contains filtered or unexported fields
}

func (*MapItem) AddValue

func (n *MapItem) AddValue(val interface{}) error

func (*MapItem) DeepCopy

func (n *MapItem) DeepCopy() *MapItem

func (*MapItem) DeepCopyAsInterface

func (n *MapItem) DeepCopyAsInterface() interface{}

func (*MapItem) DeepCopyAsNode

func (n *MapItem) DeepCopyAsNode() Node

func (*MapItem) GetAnnotations

func (n *MapItem) GetAnnotations() interface{}

func (*MapItem) GetMetas

func (n *MapItem) GetMetas() []*Meta

func (*MapItem) GetPosition

func (n *MapItem) GetPosition() *filepos.Position

func (*MapItem) GetValues

func (n *MapItem) GetValues() []interface{}

func (*MapItem) MarshalJSON added in v0.15.0

func (n *MapItem) MarshalJSON() ([]byte, error)

func (*MapItem) MarshalYAML

func (n *MapItem) MarshalYAML() (interface{}, error)

func (*MapItem) ResetValue

func (n *MapItem) ResetValue()

func (*MapItem) SetAnnotations

func (n *MapItem) SetAnnotations(anns interface{})

func (*MapItem) SetValue

func (n *MapItem) SetValue(val interface{}) error

type Meta

type Meta struct {
	Data     string
	Position *filepos.Position
}

func (*Meta) DeepCopy

func (n *Meta) DeepCopy() *Meta

type MetaSlice

type MetaSlice []*Meta

func (MetaSlice) DeepCopy

func (s MetaSlice) DeepCopy() MetaSlice

type Node

type Node interface {
	GetPosition() *filepos.Position

	GetValues() []interface{} // ie children
	SetValue(interface{}) error
	AddValue(interface{}) error
	ResetValue()

	GetMetas() []*Meta

	GetAnnotations() interface{}
	SetAnnotations(interface{})

	DeepCopyAsInterface() interface{}
	DeepCopyAsNode() Node
	// contains filtered or unexported methods
}

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

func NewParser

func NewParser(withoutMeta bool) *Parser

func (*Parser) ParseBytes

func (p *Parser) ParseBytes(data []byte, associatedName string) (*DocumentSet, error)

type Printer

type Printer struct {
	// contains filtered or unexported fields
}

func NewPrinter

func NewPrinter(writer io.Writer) Printer

func NewPrinterWithOpts

func NewPrinterWithOpts(writer io.Writer, opts PrinterOpts) Printer

func (Printer) Print

func (p Printer) Print(val interface{})

func (Printer) PrintStr

func (p Printer) PrintStr(val interface{}) string

type PrinterOpts

type PrinterOpts struct {
	ExcludeRefs bool
}

type WrappedFilePositionPrinter added in v0.14.0

type WrappedFilePositionPrinter struct {
	Printer *FilePositionPrinter
}

func (WrappedFilePositionPrinter) Print added in v0.14.0

func (p WrappedFilePositionPrinter) Print(item *Document) error

type YAMLPrinter added in v0.14.0

type YAMLPrinter struct {
	// contains filtered or unexported fields
}

func NewYAMLPrinter added in v0.14.0

func NewYAMLPrinter(writer io.Writer) *YAMLPrinter

func (*YAMLPrinter) Print added in v0.14.0

func (p *YAMLPrinter) Print(item *Document) error

Jump to

Keyboard shortcuts

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