MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / escapeEscapedString

Function escapeEscapedString

pkg/sql/ast/value.go:222–241  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

220}
221
222func escapeEscapedString(s string) string {
223 var result strings.Builder
224 for _, ch := range s {
225 switch ch {
226 case '\'':
227 result.WriteString(`\'`)
228 case '\\':
229 result.WriteString(`\\`)
230 case '\n':
231 result.WriteString(`\n`)
232 case '\t':
233 result.WriteString(`\t`)
234 case '\r':
235 result.WriteString(`\r`)
236 default:
237 result.WriteRune(ch)
238 }
239 }
240 return result.String()
241}
242
243func escapeUnicodeString(s string) string {
244 var result strings.Builder

Callers 2

StringMethod · 0.85
TestEscapeEscapedStringFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by 1

TestEscapeEscapedStringFunction · 0.68