Versions in this module Expand all Collapse all v1 v1.9.10 Feb 20, 2023 v1.9.9 Feb 20, 2023 Changes in this version + const DefaultIndentSpaces + const StructTagName + var ErrInvalidCommentMapValue = xerrors.New("invalid comment map value. it must be not nil value") + var ErrInvalidPath = xerrors.New("invalid path instance") + var ErrInvalidPathString = xerrors.New("invalid path string") + var ErrInvalidQuery = xerrors.New("invalid query") + var ErrNotFoundNode = xerrors.New("node not found") + var ErrUnknownCommentPositionType = xerrors.New("unknown comment position type") + func ErrUnsupportedHeadPositionType(node ast.Node) error + func FormatError(e error, colored, inclSource bool) string + func IsInvalidAliasNameError(err error) bool + func IsInvalidAnchorNameError(err error) bool + func IsInvalidPathError(err error) bool + func IsInvalidPathStringError(err error) bool + func IsInvalidQueryError(err error) bool + func IsInvalidTokenTypeError(err error) bool + func IsNotFoundNodeError(err error) bool + func JSONToYAML(bytes []byte) ([]byte, error) + func Marshal(v interface{}) ([]byte, error) + func MarshalContext(ctx context.Context, v interface{}, opts ...EncodeOption) ([]byte, error) + func MarshalWithOptions(v interface{}, opts ...EncodeOption) ([]byte, error) + func NodeToValue(node ast.Node, v interface{}, opts ...DecodeOption) error + func Unmarshal(data []byte, v interface{}) error + func UnmarshalContext(ctx context.Context, data []byte, v interface{}, opts ...DecodeOption) error + func UnmarshalWithOptions(data []byte, v interface{}, opts ...DecodeOption) error + func ValueToNode(v interface{}, opts ...EncodeOption) (ast.Node, error) + func YAMLToJSON(bytes []byte) ([]byte, error) + type BytesMarshaler interface + MarshalYAML func() ([]byte, error) + type BytesMarshalerContext interface + MarshalYAML func(context.Context) ([]byte, error) + type BytesUnmarshaler interface + UnmarshalYAML func([]byte) error + type BytesUnmarshalerContext interface + UnmarshalYAML func(context.Context, []byte) error + type Comment struct + Position CommentPosition + Texts []string + func HeadComment(texts ...string) *Comment + func LineComment(text string) *Comment + type CommentMap map[string]*Comment + type CommentPosition int + const CommentHeadPosition + const CommentLinePosition + func (p CommentPosition) String() string + type DecodeOption func(d *Decoder) error + func CommentToMap(cm CommentMap) DecodeOption + func DisallowDuplicateKey() DecodeOption + func DisallowUnknownField() DecodeOption + func RecursiveDir(isRecursive bool) DecodeOption + func ReferenceDirs(dirs ...string) DecodeOption + func ReferenceFiles(files ...string) DecodeOption + func ReferenceReaders(readers ...io.Reader) DecodeOption + func Strict() DecodeOption + func UseJSONUnmarshaler() DecodeOption + func UseOrderedMap() DecodeOption + func Validator(v StructValidator) DecodeOption + type Decoder struct + func NewDecoder(r io.Reader, opts ...DecodeOption) *Decoder + func (d *Decoder) Decode(v interface{}) error + func (d *Decoder) DecodeContext(ctx context.Context, v interface{}) error + func (d *Decoder) DecodeFromNode(node ast.Node, v interface{}) error + func (d *Decoder) DecodeFromNodeContext(ctx context.Context, node ast.Node, v interface{}) error + type EncodeOption func(e *Encoder) error + func Flow(isFlowStyle bool) EncodeOption + func Indent(spaces int) EncodeOption + func IndentSequence(indent bool) EncodeOption + func JSON() EncodeOption + func MarshalAnchor(callback func(*ast.AnchorNode, interface{}) error) EncodeOption + func UseJSONMarshaler() EncodeOption + func UseLiteralStyleIfMultiline(useLiteralStyleIfMultiline bool) EncodeOption + func UseSingleQuote(sq bool) EncodeOption + func WithComment(cm CommentMap) EncodeOption + type Encoder struct + func NewEncoder(w io.Writer, opts ...EncodeOption) *Encoder + func (e *Encoder) Close() error + func (e *Encoder) Encode(v interface{}) error + func (e *Encoder) EncodeContext(ctx context.Context, v interface{}) error + func (e *Encoder) EncodeToNode(v interface{}) (ast.Node, error) + func (e *Encoder) EncodeToNodeContext(ctx context.Context, v interface{}) (ast.Node, error) + type FieldError interface + StructField func() string + type InterfaceMarshaler interface + MarshalYAML func() (interface{}, error) + type InterfaceMarshalerContext interface + MarshalYAML func(context.Context) (interface{}, error) + type InterfaceUnmarshaler interface + UnmarshalYAML func(func(interface{}) error) error + type InterfaceUnmarshalerContext interface + UnmarshalYAML func(context.Context, func(interface{}) error) error + type IsZeroer interface + IsZero func() bool + type MapItem struct + Key interface{} + Value interface{} + type MapSlice []MapItem + func (s MapSlice) ToMap() map[interface{}]interface{} + type Path struct + func PathString(s string) (*Path, error) + func (p *Path) AnnotateSource(source []byte, colored bool) ([]byte, error) + func (p *Path) Filter(target, v interface{}) error + func (p *Path) FilterFile(f *ast.File) (ast.Node, error) + func (p *Path) FilterNode(node ast.Node) (ast.Node, error) + func (p *Path) MergeFromFile(dst *ast.File, src *ast.File) error + func (p *Path) MergeFromNode(dst *ast.File, src ast.Node) error + func (p *Path) MergeFromReader(dst *ast.File, src io.Reader) error + func (p *Path) Read(r io.Reader, v interface{}) error + func (p *Path) ReadNode(r io.Reader) (ast.Node, error) + func (p *Path) ReplaceWithFile(dst *ast.File, src *ast.File) error + func (p *Path) ReplaceWithNode(dst *ast.File, node ast.Node) error + func (p *Path) ReplaceWithReader(dst *ast.File, src io.Reader) error + func (p *Path) String() string + type PathBuilder struct + func (b *PathBuilder) Build() *Path + func (b *PathBuilder) Child(name string) *PathBuilder + func (b *PathBuilder) Index(idx uint) *PathBuilder + func (b *PathBuilder) IndexAll() *PathBuilder + func (b *PathBuilder) Recursive(selector string) *PathBuilder + func (b *PathBuilder) Root() *PathBuilder + type StructField struct + AliasName string + AnchorName string + FieldName string + IsAutoAlias bool + IsAutoAnchor bool + IsFlow bool + IsInline bool + IsOmitEmpty bool + RenderName string + type StructFieldMap map[string]*StructField + type StructValidator interface + Struct func(interface{}) error