yamlencoder

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: Apache-2.0 Imports: 10 Imported by: 2

README

yaml-encoder

An optional yaml encoder for goschtalt.

Build Status codecov.io Go Report Card GitHub Release GoDoc

Documentation

Overview

yamlencoder provides a way to encode both the simple form and the detailed form of configuration data for the goschtalt library.

Detailed Output

The details about where the configuration value originated are included as a list of `file:line[col]` values in a comment if goschtalt knows the origin. Not all decoders support tracking all this information. Comment will always be present so it's easier to handle the file using simple cli text processors.

Example

candy: bar                      # file.yml:1[8]
cats:                           # file.yml:2[1]
    - madd                      # file.yml:3[7]
    - tabby                     # file.yml:4[7]
other:                          # file.yml:5[1]
    things:                     # file.yml:6[5]
        green:                  # file.yml:8[9]
            - grass             # unknown
            - ground            # file.yml:10[15]
        red: balloons           # file.yml:7[14]
    trending: now               # file.yml:12[15]

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEncoding = errors.New("encoding error")
)

Functions

This section is empty.

Types

type Encoder

type Encoder struct{}

Encoder is a class for the yaml encoder.

func (Encoder) Encode

func (e Encoder) Encode(a any) ([]byte, error)

Encode encodes the value provided into yaml and returns the bytes.

func (Encoder) EncodeExtended

func (e Encoder) EncodeExtended(obj meta.Object) ([]byte, error)

Encode encodes the meta.Object provided into yaml with comments showing the origin of the configuration and returns the bytes.

func (Encoder) Extensions

func (e Encoder) Extensions() []string

Extensions returns the supported extensions.

Jump to

Keyboard shortcuts

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