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

Method encodeString

encode.go:590–599  ·  view source on GitHub ↗
(v string, column int)

Source from the content-addressed store, hash-verified

588}
589
590func (e *Encoder) encodeString(v string, column int) *ast.StringNode {
591 if e.isNeedQuoted(v) {
592 if e.singleQuote {
593 v = quoteWith(v, '\'')
594 } else {
595 v = strconv.Quote(v)
596 }
597 }
598 return ast.String(token.New(v, v, e.pos(column)))
599}
600
601func (e *Encoder) encodeBool(v bool) *ast.BoolNode {
602 value := strconv.FormatBool(v)

Callers 5

encodeByMarshalerMethod · 0.95
encodeValueMethod · 0.95
encodeMapItemMethod · 0.95
encodeMapMethod · 0.95
encodeStructMethod · 0.95

Calls 5

isNeedQuotedMethod · 0.95
posMethod · 0.95
StringFunction · 0.92
NewFunction · 0.92
quoteWithFunction · 0.85

Tested by

no test coverage detected