codec.go raw

   1  package yaml
   2  
   3  import "gopkg.in/yaml.v3"
   4  
   5  // Codec implements the encoding.Encoder and encoding.Decoder interfaces for YAML encoding.
   6  type Codec struct{}
   7  
   8  func (Codec) Encode(v map[string]any) ([]byte, error) {
   9  	return yaml.Marshal(v)
  10  }
  11  
  12  func (Codec) Decode(b []byte, v map[string]any) error {
  13  	return yaml.Unmarshal(b, &v)
  14  }
  15