toml

package
v1.17.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Empty = empty("")
)

Variables

This section is empty.

Functions

func Marshal

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

Types

type Loader

type Loader interface {
	Load() (*Tree, error)
}

Loader represents a source for a toml config.

func FromCommandLine

func FromCommandLine(cmd string, args ...string) Loader

FromCommandLine creates a TOML source from the output of a shell command and its corresponding args. If the command is empty, an empty config is returned.

func FromFile

func FromFile(path string) Loader

FromFile creates a TOML source from the specified file. If an empty string is passed an empty toml config is used.

type Tree

type Tree toml.Tree

func Load

func Load(content string) (*Tree, error)

func LoadBytes

func LoadBytes(b []byte) (*Tree, error)

func LoadFile

func LoadFile(path string) (*Tree, error)

func LoadMap

func LoadMap(m map[string]interface{}) (*Tree, error)

func TreeFromMap

func TreeFromMap(m map[string]interface{}) (*Tree, error)

func (*Tree) Copy

func (t *Tree) Copy() *Tree

Copy produces a copy of the contents of the Tree.

func (*Tree) Delete

func (t *Tree) Delete(key string) error

func (*Tree) DeletePath

func (t *Tree) DeletePath(keys []string) error

func (*Tree) Get

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

func (*Tree) GetPath

func (t *Tree) GetPath(keys []string) interface{}

func (*Tree) GetSubtreeByPath

func (t *Tree) GetSubtreeByPath(keys []string) *Tree

func (*Tree) HasPath

func (t *Tree) HasPath(keys []string) bool

func (*Tree) Keys

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

func (*Tree) Raw

func (t *Tree) Raw() *toml.Tree

func (*Tree) Save

func (t *Tree) Save(path string) (int64, error)

Save writes the config to the specified path

func (*Tree) Set

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

func (*Tree) SetPath

func (t *Tree) SetPath(keys []string, value interface{})

func (*Tree) String

func (t *Tree) String() string

func (*Tree) ToMap

func (t *Tree) ToMap() map[string]interface{}

Jump to

Keyboard shortcuts

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