Documentation ¶
Overview ¶
Package encode implements Go types encoding into YAML as part of yamly engine.
Index ¶
- type ASTBuilder
- func (b *ASTBuilder) EndMapping()
- func (b *ASTBuilder) EndSequence()
- func (b *ASTBuilder) InsertBoolean(val bool)
- func (b *ASTBuilder) InsertFloat(val float64)
- func (b *ASTBuilder) InsertInteger(val int64)
- func (b *ASTBuilder) InsertNull()
- func (b *ASTBuilder) InsertRaw(data []byte, err error)
- func (b *ASTBuilder) InsertRawText(text []byte, err error)
- func (b *ASTBuilder) InsertString(val string)
- func (b *ASTBuilder) InsertTimestamp(val time.Time)
- func (b *ASTBuilder) InsertUnsigned(val uint64)
- func (b *ASTBuilder) Result() (ast.Node, error)
- func (b *ASTBuilder) StartMapping()
- func (b *ASTBuilder) StartSequence()
- type ASTBuilderOption
- type ASTWriter
- func (w *ASTWriter) VisitAliasNode(n *ast.AliasNode)
- func (w *ASTWriter) VisitAnchorNode(n *ast.AnchorNode)
- func (w *ASTWriter) VisitContentNode(n *ast.ContentNode)
- func (w *ASTWriter) VisitMappingEntryNode(n *ast.MappingEntryNode)
- func (w *ASTWriter) VisitMappingNode(n *ast.MappingNode)
- func (w *ASTWriter) VisitNullNode(n *ast.NullNode)
- func (w *ASTWriter) VisitPropertiesNode(n *ast.PropertiesNode)
- func (w *ASTWriter) VisitSequenceNode(n *ast.SequenceNode)
- func (w *ASTWriter) VisitStreamNode(n *ast.StreamNode)
- func (w *ASTWriter) VisitTagNode(n *ast.TagNode)
- func (w *ASTWriter) VisitTextNode(n *ast.TextNode)
- func (w *ASTWriter) WriteBytes(ast ast.Node) ([]byte, error)
- func (w *ASTWriter) WriteString(ast ast.Node) (string, error)
- func (w *ASTWriter) WriteTo(dst io.Writer, ast ast.Node) error
- type AnchorsKeeper
- type WriteOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ASTBuilder ¶
type ASTBuilder struct {
// contains filtered or unexported fields
}
ASTBuilder implements yamly.TreeBuilder
func NewASTBuilder ¶
func NewASTBuilder(opts ...ASTBuilderOption) *ASTBuilder
func (*ASTBuilder) EndMapping ¶
func (b *ASTBuilder) EndMapping()
func (*ASTBuilder) EndSequence ¶
func (b *ASTBuilder) EndSequence()
func (*ASTBuilder) InsertBoolean ¶
func (b *ASTBuilder) InsertBoolean(val bool)
func (*ASTBuilder) InsertFloat ¶
func (b *ASTBuilder) InsertFloat(val float64)
func (*ASTBuilder) InsertInteger ¶
func (b *ASTBuilder) InsertInteger(val int64)
func (*ASTBuilder) InsertNull ¶
func (b *ASTBuilder) InsertNull()
func (*ASTBuilder) InsertRaw ¶
func (b *ASTBuilder) InsertRaw(data []byte, err error)
func (*ASTBuilder) InsertRawText ¶
func (b *ASTBuilder) InsertRawText(text []byte, err error)
func (*ASTBuilder) InsertString ¶
func (b *ASTBuilder) InsertString(val string)
func (*ASTBuilder) InsertTimestamp ¶
func (b *ASTBuilder) InsertTimestamp(val time.Time)
func (*ASTBuilder) InsertUnsigned ¶
func (b *ASTBuilder) InsertUnsigned(val uint64)
func (*ASTBuilder) StartMapping ¶
func (b *ASTBuilder) StartMapping()
func (*ASTBuilder) StartSequence ¶
func (b *ASTBuilder) StartSequence()
type ASTBuilderOption ¶
type ASTBuilderOption func(*builderOpts)
ASTBuilderOption allows to modify ASTBuilder behavior
func WithUnquotedOneLineStrings ¶
func WithUnquotedOneLineStrings() ASTBuilderOption
WithUnquotedOneLineStrings make ASTBuilder create nodes for one-line strings with absent quoting style (instead of default double quoting style)
type ASTWriter ¶
type ASTWriter struct {
// contains filtered or unexported fields
}
ASTWriter implements yamly.TreeWriter
func NewASTWriter ¶
func NewASTWriter(opts ...WriteOption) *ASTWriter
func (*ASTWriter) VisitAliasNode ¶
func (*ASTWriter) VisitAnchorNode ¶
func (w *ASTWriter) VisitAnchorNode(n *ast.AnchorNode)
func (*ASTWriter) VisitContentNode ¶
func (w *ASTWriter) VisitContentNode(n *ast.ContentNode)
func (*ASTWriter) VisitMappingEntryNode ¶
func (w *ASTWriter) VisitMappingEntryNode(n *ast.MappingEntryNode)
func (*ASTWriter) VisitMappingNode ¶
func (w *ASTWriter) VisitMappingNode(n *ast.MappingNode)
func (*ASTWriter) VisitNullNode ¶
func (*ASTWriter) VisitPropertiesNode ¶
func (w *ASTWriter) VisitPropertiesNode(n *ast.PropertiesNode)
func (*ASTWriter) VisitSequenceNode ¶
func (w *ASTWriter) VisitSequenceNode(n *ast.SequenceNode)
func (*ASTWriter) VisitStreamNode ¶
func (w *ASTWriter) VisitStreamNode(n *ast.StreamNode)
func (*ASTWriter) VisitTagNode ¶
func (*ASTWriter) VisitTextNode ¶
type AnchorsKeeper ¶
type AnchorsKeeper interface { // StoreAnchor marks anchor name as met. StoreAnchor(anchorName string) // BindToLatestAnchor binds given node to the most recent stored anchor name. BindToLatestAnchor(n ast.Node) // DereferenceAlias returns node associated with given alias (anchor name). // If alias was not stored or node was not bound to it, returns an error DereferenceAlias(alias string) (ast.Node, error) }
AnchorsKeeper defines methods to bind anchors to aliases and dereference aliases.
type WriteOption ¶
type WriteOption func(*writeOptions)
WriteOption allows to modify ASTWriter behavior
func WithAnchorsKeeper ¶
func WithAnchorsKeeper(ak AnchorsKeeper) WriteOption
WithAnchorsKeeper makes ASTWriter use provided AnchorsKeeper and dereference unknown aliases (i.e. aliases for anchors which are not contained in written AST)