feat: add gyaml

This commit is contained in:
tiglog 2023-08-12 21:39:06 +08:00
parent fdd5b07992
commit 567aafb140

22
encoding/gyaml/yaml.go Normal file
View File

@ -0,0 +1,22 @@
//
// yaml.go
// Copyright (C) 2023 tiglog <me@tiglog.com>
//
// Distributed under terms of the MIT license.
//
package gyaml
import "gopkg.in/yaml.v3"
// For example:
//
// type T struct {
// F int `yaml:"a,omitempty"`
// B int
// }
// var t T
// gyaml.Decode([]byte("a: 1\nb: 2"), &t)
func Decode(buf []byte, dest any) error {
return yaml.Unmarshal(buf, dest)
}