MCPcopy
hub / github.com/dosco/graphjin / writeGraphQLStringLiteral

Function writeGraphQLStringLiteral

core/database_join.go:288–300  ·  view source on GitHub ↗
(buf *bytes.Buffer, s string)

Source from the content-addressed store, hash-verified

286}
287
288func writeGraphQLStringLiteral(buf *bytes.Buffer, s string) {
289 if isJSONStringLiteral(s) {
290 buf.WriteString(s)
291 return
292 }
293
294 b, err := json.Marshal(s)
295 if err != nil {
296 buf.WriteString("null")
297 return
298 }
299 buf.Write(b)
300}
301
302func isJSONStringLiteral(s string) bool {
303 if len(s) < 2 || s[0] != '"' {

Callers 1

writeGraphQLLiteralFunction · 0.85

Calls 3

isJSONStringLiteralFunction · 0.85
WriteStringMethod · 0.65
WriteMethod · 0.65

Tested by

no test coverage detected