package toml
import "github.com/pelletier/go-toml"
TOML markup language parser.
This version supports the specification as described in https://github.com/toml-lang/toml/blob/master/versions/toml-v0.2.0.md
Index ¶
- type TomlTree
- func Load(content string) (tree *TomlTree, err error)
- func LoadFile(path string) (tree *TomlTree, err error)
- func (t *TomlTree) Get(key string) interface{}
- func (t *TomlTree) GetDefault(key string, def interface{}) interface{}
- func (t *TomlTree) GetPath(keys []string) interface{}
- func (t *TomlTree) Has(key string) bool
- func (t *TomlTree) Keys() []string
- func (t *TomlTree) Set(key string, value interface{})
- func (t *TomlTree) SetPath(keys []string, value interface{})
- func (t *TomlTree) ToString() string
Types ¶
type TomlTree ¶
type TomlTree map[string]interface{}
Definition of a TomlTree. This is the result of the parsing of a TOML file.
func Load ¶
Create a TomlTree from a string.
func LoadFile ¶
Create a TomlTree from a file.
func (*TomlTree) Get ¶
Get the value at key in the TomlTree. Key is a dot-separated path (e.g. a.b.c). Returns nil if the path does not exist in the tree. If keys is of length zero, the current tree is returned.
func (*TomlTree) GetDefault ¶
Same as Get but with a default value
func (*TomlTree) GetPath ¶
Returns the element in the tree indicated by 'keys'. If keys is of length zero, the current tree is returned.
func (*TomlTree) Has ¶
Has returns a boolean indicating if the toplevel tree contains the given key.
func (*TomlTree) Keys ¶
Keys returns the keys of the toplevel tree. Warning: this is a costly operation.
func (*TomlTree) Set ¶
Set an element in the tree. Key is a dot-separated path (e.g. a.b.c). Creates all necessary intermediates trees, if needed.
func (*TomlTree) SetPath ¶
func (*TomlTree) ToString ¶
Generates a human-readable representation of the current tree. Output spans multiple lines, and is suitable for ingest by a TOML parser
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd |
- Version
- v0.2.0
- Published
- Jul 9, 2014
- Platform
- linux/amd64
- Imports
- 11 packages
- Last checked
- 10 minutes ago –
Tools for package owners.