gyaml

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(src any, path string) (any, error)

Get returns a child of the given value according to a dotted path.

Types

type GYAML

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

GYAML represents a complex internal YAML structure with convenient access methods, using dotted path syntax

func New

func New(data any) *GYAML

func ParseJson

func ParseJson(src string) (*GYAML, error)

ParseJson reads a JSON configuration from the given string.

func ParseJsonFile

func ParseJsonFile(filename string) (*GYAML, error)

ParseJsonFile reads a JSON configuration from the given filename.

func ParseYaml

func ParseYaml(src string) (*GYAML, error)

ParseYaml reads a YAML configuration from the given string.

func ParseYamlBytes

func ParseYamlBytes(src []byte) (*GYAML, error)

ParseYamlBytes reads a YAML configuration from the given []byte.

func ParseYamlFile

func ParseYamlFile(filename string) (*GYAML, error)

ParseYamlFile reads a YAML configuration from the given filename.

func (*GYAML) Bool

func (y *GYAML) Bool(path string) (bool, error)

Bool returns a bool according to a dotted path.

func (*GYAML) DBool

func (y *GYAML) DBool(path string, defaults ...bool) bool

DBool returns a bool according to a dotted path or default value or false.

func (*GYAML) DFloat64

func (y *GYAML) DFloat64(path string, defaults ...float64) float64

DFloat64 returns a float64 according to a dotted path or default value or 0.

func (*GYAML) DInt

func (y *GYAML) DInt(path string, defaults ...int) int

DInt returns an int according to a dotted path or default value or 0.

func (*GYAML) DList

func (y *GYAML) DList(path string, defaults ...[]any) []any

DList returns a []any according to a dotted path or defaults or []any.

func (*GYAML) DMap

func (y *GYAML) DMap(path string, defaults ...map[string]any) map[string]any

DMap returns a map[string]any according to a dotted path or default or map[string]any.

func (*GYAML) DString

func (y *GYAML) DString(path string, defaults ...string) string

DString returns a string according to a dotted path or default or "".

func (*GYAML) Data

func (y *GYAML) Data() any

func (*GYAML) Float64

func (y *GYAML) Float64(path string) (float64, error)

Float64 returns a float64 according to a dotted path.

func (*GYAML) Get

func (y *GYAML) Get(path string) (*GYAML, error)

Get returns a nested element according to a dotted path.

func (*GYAML) Int

func (y *GYAML) Int(path string) (int, error)

Int returns an int according to a dotted path.

func (*GYAML) List

func (y *GYAML) List(path string) ([]any, error)

List returns a []any according to a dotted path.

func (*GYAML) Map

func (y *GYAML) Map(path string) (map[string]any, error)

Map returns a map[string]any according to a dotted path.

func (*GYAML) String

func (y *GYAML) String(path string) (string, error)

String returns a string according to a dotted path.

Jump to

Keyboard shortcuts

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