yaml

package
v1.3.0-SNAPSHOT.93 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Yaml

type Yaml struct {
	// contains filtered or unexported fields
}

func NewYaml

func NewYaml(body []byte) (*Yaml, error)

NewYaml returns a pointer to a new `Yaml` object after unmarshaling `body` bytes

func (*Yaml) Array

func (y *Yaml) Array() ([]*Yaml, error)

Array type asserts to an `array`

func (*Yaml) Bool

func (y *Yaml) Bool() (bool, error)

Bool type asserts to `bool`

func (*Yaml) Float

func (y *Yaml) Float() (float64, error)

func (*Yaml) Get

func (y *Yaml) Get(key any) *Yaml

Get returns a pointer to a new `Yaml` object for `key` in its `map` representation

Example:

     y.Get("xx").Get("yy").Int()
		y.Get("notPresent").IsFound()

func (*Yaml) GetArraySize

func (y *Yaml) GetArraySize() (int, error)

return the size of array

func (*Yaml) GetIndex

func (y *Yaml) GetIndex(index int) *Yaml

GetIndex returns a pointer to a new `Yaml` object. for `index` in its `array` representation

Example:

y.Get("xx").GetIndex(1).String()

func (*Yaml) GetMapKeys

func (y *Yaml) GetMapKeys() ([]string, error)

Get all the keys of the map

func (*Yaml) GetPath

func (y *Yaml) GetPath(branch ...any) *Yaml

GetPath searches for the item as specified by the branch

Example:

y.GetPath("bb", "cc").Int()

func (*Yaml) Int

func (y *Yaml) Int() (int, error)

Int type asserts to `int`

func (*Yaml) IsArray

func (y *Yaml) IsArray() bool

func (*Yaml) IsFound

func (y *Yaml) IsFound() bool

Check if the given branch was found

func (*Yaml) IsMap

func (y *Yaml) IsMap() bool

Check if it is a map

func (*Yaml) Map

func (y *Yaml) Map() (map[string]*Yaml, error)

Map type asserts to `map`

func (*Yaml) Pos

func (y *Yaml) Pos() (int, int)

func (*Yaml) String

func (y *Yaml) String() (string, error)

String type asserts to `string`

Jump to

Keyboard shortcuts

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