(buf *bytes.Buffer, in string)
| 159 | } |
| 160 | |
| 161 | func pgwireFormatStringInArray(buf *bytes.Buffer, in string) { |
| 162 | quote := pgwireQuoteStringInArray(in) |
| 163 | if quote { |
| 164 | buf.WriteByte('"') |
| 165 | } |
| 166 | // Loop through each unicode code point. |
| 167 | for _, r := range in { |
| 168 | if r == '"' || r == '\\' { |
| 169 | // Strings in arrays escape " and \. |
| 170 | buf.WriteByte('\\') |
| 171 | buf.WriteByte(byte(r)) |
| 172 | } else { |
| 173 | buf.WriteRune(r) |
| 174 | } |
| 175 | } |
| 176 | if quote { |
| 177 | buf.WriteByte('"') |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | // From: https://github.com/golang/go/blob/master/src/strings/strings.go |
| 182 |
no test coverage detected
searching dependent graphs…