MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / jsonCast

Method jsonCast

pkg/sql/sem/tree/pretty.go:2484–2490  ·  view source on GitHub ↗

jsonCast attempts to pretty print a string that is cast or asserted as JSON.

(sv *StrVal, op string, typ *types.T)

Source from the content-addressed store, hash-verified

2482
2483// jsonCast attempts to pretty print a string that is cast or asserted as JSON.
2484func (p *PrettyCfg) jsonCast(sv *StrVal, op string, typ *types.T) pretty.Doc {
2485 return pretty.Fold(pretty.Concat,
2486 p.jsonString(sv.RawString()),
2487 pretty.Text(op),
2488 p.formatType(typ),
2489 )
2490}
2491
2492// jsonString parses s as JSON and pretty prints it.
2493func (p *PrettyCfg) jsonString(s string) pretty.Doc {

Callers 2

docMethod · 0.80
docMethod · 0.80

Calls 5

jsonStringMethod · 0.95
formatTypeMethod · 0.95
FoldFunction · 0.92
TextFunction · 0.92
RawStringMethod · 0.80

Tested by

no test coverage detected