func ValueToNode(v interface{}, opts ...EncodeOption) (ast.Node, error) {
	var buf bytes.Buffer
	node, err := NewEncoder(&buf, opts...).EncodeToNode(v)
	if err != nil {
		return nil, errors.Wrapf(err, "failed to convert value to node")
	}
	return node, nil
}
ValueToNode convert from value to ast.Node.
package yaml
import (
	"bytes"
	"context"
	"io"
	"github.com/goccy/go-yaml/ast"
	"github.com/goccy/go-yaml/internal/errors"
	"golang.org/x/xerrors"
)
type BytesMarshaler interface {
	MarshalYAML() ([]byte, error)
}
type BytesMarshalerContext interface {
	MarshalYAML(context.Context) ([]byte, error)
}
type InterfaceMarshaler interface {
	MarshalYAML() (interface{}, error)
}
type InterfaceMarshalerContext interface {
	MarshalYAML(context.Context) (interface{}, error)
}
type BytesUnmarshaler interface {
	UnmarshalYAML([]byte) error
}
type BytesUnmarshalerContext interface {
	UnmarshalYAML(context.Context, []byte) error
}
type InterfaceUnmarshaler interface {
	UnmarshalYAML(func(interface{}) error) error
}
type InterfaceUnmarshalerContext interface {
	UnmarshalYAML(context.Context, func(interface{}) error) error
}
type MapItem struct {
	Key, Value interface{}
}
type MapSlice []MapItem
func (s MapSlice) ToMap() map[interface{}]interface{} {
	v := map[interface{}]interface{}{}
	for _, item := range s {
		v[item.Key] = item.Value
	}
	return v
}
func Marshal(v interface{}) ([]byte, error) {
	return MarshalWithOptions(v)
}
func MarshalWithOptions(v interface{}, opts ...EncodeOption) ([]byte, error) {
	return MarshalContext(context.Background(), v, opts...)
}
func MarshalContext(ctx context.Context, v interface{}, opts ...EncodeOption) ([]byte, error) {
	var buf bytes.Buffer
	if err := NewEncoder(&buf, opts...).EncodeContext(ctx, v); err != nil {
		return nil, errors.Wrapf(err, "failed to marshal")
	}
	return buf.Bytes(), nil
}