toyaml

package module
v0.0.0-...-e51c6cf Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2018 License: MIT Imports: 4 Imported by: 0

README

ToYAML

Convert TOML encoded bytes to YAML encoded bytes.

Usage

type bar struct {
  HogeFuga int
}

type example struct {
  Foo string
  Bar bar
}

func main() {
  b, _ := toml.Marshal(&example{Foo: "foo", Bar: bar{HogeFuga: 100}})
  yamlText, _ := ToYAML(b)

  fmt.Println(string(yamlText))

  // Bar:
  //   HogeFuga: 100
  // Foo: foo
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToYAML

func ToYAML(t interface{}) ([]byte, error)

ToYAML receives TOML encoded bytes `t` and converts `t` to YAML encoded bytes. `t` must be []byte, string or io.Reader. If some fields have "toml" tag, its "json" tag's value must be same value "toml" one.

Types

This section is empty.

Jump to

Keyboard shortcuts

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