yamlmeta

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewASTFromInterface

func NewASTFromInterface(val interface{}) interface{}

func PlainMarshal

func PlainMarshal(val interface{}) ([]byte, error)

func PlainUnmarshal

func PlainUnmarshal(data []byte, val 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) 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) 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) 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 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) 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) 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 InterfaceConvertOpts

type InterfaceConvertOpts struct {
	OrderedMap bool
}

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) 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) 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
}

Jump to

Keyboard shortcuts

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