1
0
mirror of https://github.com/TomWright/dasel.git synced 2022-05-22 02:32:45 +03:00
Files
dasel-data-selector/internal/storage/yaml.go
2020-09-22 15:06:37 +01:00

20 lines
461 B
Go

package storage
import (
"fmt"
"gopkg.in/yaml.v2"
)
// YAMLParser is a Parser implementation to handle yaml files.
type YAMLParser struct {
}
// FromBytes returns some Data that is represented by the given bytes.
func (p *YAMLParser) FromBytes(byteData []byte) (interface{}, error) {
var data interface{}
if err := yaml.Unmarshal(byteData, &data); err != nil {
return data, fmt.Errorf("could not unmarshal config data: %w", err)
}
return data, nil
}