MCPcopy
hub / github.com/dgraph-io/dgraph / toString

Function toString

query/outputnode_graphql.go:1400–1402  ·  view source on GitHub ↗

toString converts the json encoded string value val to a go string. It should be used only in scenarios where the underlying string is simple, i.e., it doesn't contain any escape sequence or any other string magic. Otherwise, better to use json.Unmarshal().

(val []byte)

Source from the content-addressed store, hash-verified

1398// It should be used only in scenarios where the underlying string is simple, i.e., it doesn't
1399// contain any escape sequence or any other string magic. Otherwise, better to use json.Unmarshal().
1400func toString(val []byte) string {
1401 return strings.Trim(string(val), `"`) // remove `"` from beginning and end
1402}
1403
1404// checkAndStripComma checks whether there is a comma at the end of the given buffer. If yes,
1405// it removes that comma from the buffer.

Callers 3

extractDgraphTypesMethod · 0.70
resolveCustomFieldMethod · 0.70
cantCoerceScalarFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected