MCPcopy Create free account
hub / github.com/dolthub/doltgresql / pgwireFormatStringInArray

Function pgwireFormatStringInArray

postgres/parser/sem/tree/pgwire_encode.go:175–193  ·  view source on GitHub ↗
(buf *bytes.Buffer, in string)

Source from the content-addressed store, hash-verified

173}
174
175func pgwireFormatStringInArray(buf *bytes.Buffer, in string) {
176 quote := pgwireQuoteStringInArray(in)
177 if quote {
178 buf.WriteByte('"')
179 }
180 // Loop through each unicode code point.
181 for _, r := range in {
182 if r == '"' || r == '\\' {
183 // Strings in arrays escape " and \.
184 buf.WriteByte('\\')
185 buf.WriteByte(byte(r))
186 } else {
187 buf.WriteRune(r)
188 }
189 }
190 if quote {
191 buf.WriteByte('"')
192 }
193}
194
195// From: https://github.com/golang/go/blob/master/src/strings/strings.go
196

Callers 1

pgwireFormatMethod · 0.85

Calls 1

pgwireQuoteStringInArrayFunction · 0.85

Tested by

no test coverage detected