mirror of
https://github.com/mikefarah/yq.git
synced 2025-01-27 17:05:35 +00:00
24 lines
383 B
Go
24 lines
383 B
Go
package yqlib
|
|
|
|
import (
|
|
"io"
|
|
|
|
yaml "gopkg.in/yaml.v3"
|
|
)
|
|
|
|
type Decoder interface {
|
|
Decode(node *yaml.Node) error
|
|
}
|
|
|
|
type yamlDecoder struct {
|
|
decoder *yaml.Decoder
|
|
}
|
|
|
|
func NewYamlDecoder(reader io.Reader) Decoder {
|
|
return &yamlDecoder{decoder: yaml.NewDecoder(reader)}
|
|
}
|
|
|
|
func (dec *yamlDecoder) Decode(rootYamlNode *yaml.Node) error {
|
|
return dec.decoder.Decode(rootYamlNode)
|
|
}
|