yamlalias

package
v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package yamlalias adds support for aliases when parsing YAML.

Aliases are specified as a comma-separated list specified via "yaml-aliases" struct tag.

Example:

type Config struct {
  UserName string `yaml:"username" yaml-aliases:"userName,user-name"`
}

This will parse the following YAML examples in the same way:

{"username": "John Doe"}
{"userName": "John Doe"}
{"user-name": "John Doe"}

Note: It only adds aliases for top-level fields in the struct.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unmarshal

func Unmarshal(in []byte, out interface{}) error

Unmarshal is a wrapper for yaml.Unmarshal but adds support for any yaml-aliases specified in out.

func UnmarshalStrict

func UnmarshalStrict(in []byte, out interface{}) error

UnmarshalStrict is a wrapper for yaml.UnmarshalStrict but adds support for any yaml-aliases specified in out.

Types

This section is empty.

Jump to

Keyboard shortcuts

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