go-toml – github.com/pelletier/go-toml Index | Files

package toml

import "github.com/pelletier/go-toml"

TOML markup language parser.

This version supports the specification as described in https://github.com/mojombo/toml/tree/e3656ad493400895f4460f1244a25f8f8e31a32a

Index

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

func Load(content string) (tree *TomlTree, err error)

Create a TomlTree from a string.

func LoadFile

func LoadFile(path string) (tree *TomlTree, err error)

Create a TomlTree from a file.

func (*TomlTree) Get

func (t *TomlTree) Get(key string) interface{}

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.

func (*TomlTree) GetDefault

func (t *TomlTree) GetDefault(key string, def interface{}) interface{}

Same as Get but with a default value

func (*TomlTree) Keys

func (t *TomlTree) Keys() []string

Keys returns the keys of the toplevel tree. Warning: this is a costly operation.

func (*TomlTree) Set

func (t *TomlTree) Set(key string, value interface{})

Set an element in the tree. Key is a dot-separated path (e.g. a.b.c). Creates all necessary intermediates trees, if needed.

Source Files

lexer.go parser.go toml.go

Version
v0.1.0
Published
Jul 1, 2013
Platform
darwin/amd64
Imports
10 packages
Last checked
1 day ago

Tools for package owners.