MCPcopy Create free account
hub / github.com/goccy/go-yaml / Encode

Method Encode

encode.go:85–87  ·  view source on GitHub ↗

Encode writes the YAML encoding of v to the stream. If multiple items are encoded to the stream, the second and subsequent document will be preceded with a "---" document separator, but the first will not. See the documentation for Marshal for details about the conversion of Go values to YAML.

(v interface{})

Source from the content-addressed store, hash-verified

83//
84// See the documentation for Marshal for details about the conversion of Go values to YAML.
85func (e *Encoder) Encode(v interface{}) error {
86 return e.EncodeContext(context.Background(), v)
87}
88
89// EncodeContext writes the YAML encoding of v to the stream with context.Context.
90func (e *Encoder) EncodeContext(ctx context.Context, v interface{}) error {

Callers 15

TestEncoderFunction · 0.95
TestEncodeWithAutoAliasFunction · 0.95
TestEncodeWithMergeFunction · 0.95
TestEncoder_InlineFunction · 0.95
TestEncoder_InlineNilFunction · 0.95
TestEncoder_FlowFunction · 0.95
TestEncoder_JSONFunction · 0.95
TestEncoder_AutoIntFunction · 0.95

Calls 1

EncodeContextMethod · 0.95

Tested by 15

TestEncoderFunction · 0.76
TestEncodeWithAutoAliasFunction · 0.76
TestEncodeWithMergeFunction · 0.76
TestEncoder_InlineFunction · 0.76
TestEncoder_InlineNilFunction · 0.76
TestEncoder_FlowFunction · 0.76
TestEncoder_JSONFunction · 0.76
TestEncoder_AutoIntFunction · 0.76