Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Document ¶
type Document interface {
// Documents *cannot* be marshalled by just throwing them into
// a YAML encoder. The yaml.v3 encoder is hard-wired to expect
// a specific type for the document node and since yaml.Document
// is a wrapper, yaml.v3 will ignore the HeadComment as it is
// not recognized as a document.
// Document implements this interface to issue a panic whenever
// an accidental attempt is made to encode it.
// Use Bytes() or Encode() instead.
// This limitation does not apply to yamled.Node objects.
yaml.Marshaler
Bytes(indent int) ([]byte, error)
Encode(encoder *yaml.Encoder) error
RootNode() (Node, error)
Get(steps ...Step) (Node, bool)
GetKey(steps ...Step) (KeyNode, bool)
MustGet(steps ...Step) Node
Set(value interface{}) error
SetKey(key Step, value interface{}) (Node, error)
SetAt(path Path, value interface{}) (Node, error)
Replace(value interface{}) error
ReplaceKey(key Step, value interface{}) (Node, error)
ReplaceAt(path Path, value interface{}) (Node, error)
DeleteKey(steps ...Step) error
ToSlice() []interface{}
ToMap() map[string]interface{}
To(val interface{}) error
HeadComment() string
LineComment() string
FootComment() string
SetHeadComment(comment string) Document
SetLineComment(comment string) Document
SetFootComment(comment string) Document
}
type KeyNode ¶ added in v0.3.0
type KeyNode interface {
fmt.Stringer
HeadComment() string
LineComment() string
FootComment() string
SetHeadComment(comment string) KeyNode
SetLineComment(comment string) KeyNode
SetFootComment(comment string) KeyNode
}
KeyNode is a specialized interface that makes setting comments for mapping keys more useful, as setting a comment on the value node itself might be undesirable.
type Node ¶
type Node interface {
yaml.Marshaler
fmt.Stringer
Bytes(indent int) ([]byte, error)
Encode(encoder *yaml.Encoder) error
Kind() yaml.Kind
Style() yaml.Style
SetStyle(style yaml.Style) error
Get(steps ...Step) (Node, bool)
GetKey(steps ...Step) (KeyNode, bool)
MustGet(steps ...Step) Node
Set(value interface{}) error
SetKey(key Step, value interface{}) (Node, error)
SetAt(path Path, value interface{}) (Node, error)
Replace(value interface{}) error
ReplaceKey(key Step, value interface{}) (Node, error)
ReplaceAt(path Path, value interface{}) (Node, error)
DeleteKey(steps ...Step) error
ToString() string
ToInt() int
ToBool() bool
ToSlice() []interface{}
ToMap() map[string]interface{}
To(val interface{}) error
HeadComment() string
LineComment() string
FootComment() string
SetHeadComment(comment string) Node
SetLineComment(comment string) Node
SetFootComment(comment string) Node
}
Click to show internal directories.
Click to hide internal directories.