yaml

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2019 License: MIT Imports: 4 Imported by: 4

Documentation

Overview

This package just provides default config for the external yaml library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InjectTemplatePipeline

func InjectTemplatePipeline(initialValue, writeTo, values interface{}) error

InjectTemplateValues is a convenience func that takes an initial value, a destination value pointer, and a pipeline value, and converts the initialValue to a YAML template, then renders it using the provided pipeline value, and finally unmarshals it to the writeTo pointer. A typical invocation may look like this:

err := InjectTemplatePipeline(v, &v, map[string]string{"hello":"world"})

Note that in the above invocation the source value v is mutated, since it is passed in as the initial value, and then a pointer to it is passed in as the second value. This is a common pattern, but is optional, you can use two unrelated values if you want to preserve the initial value of v.

func Marshal

func Marshal(in interface{}) ([]byte, error)

func Unmarshal

func Unmarshal(in []byte, out interface{}) error

Types

type RenderedYAML

type RenderedYAML struct {
	Bytes []byte
	Error error
}

func (*RenderedYAML) String

func (y *RenderedYAML) String() string

func (*RenderedYAML) Unmarshal

func (t *RenderedYAML) Unmarshal(v interface{}) error

type Template

type Template struct {
	Template *template.Template
}

func NewTemplateFromValue

func NewTemplateFromValue(v interface{}) (*Template, error)

func (*Template) SetPipeline

func (t *Template) SetPipeline(a interface{}) *TemplateWithPipeline

type TemplateWithPipeline

type TemplateWithPipeline struct {
	Template *template.Template
	Pipeline interface{}
}

func (*TemplateWithPipeline) Render

func (t *TemplateWithPipeline) Render() *RenderedYAML

Jump to

Keyboard shortcuts

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